diff options
author | Matthew Holt <[email protected]> | 2019-12-31 16:57:54 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-12-31 16:57:54 -0700 |
commit | 788462bd4c9c332b3f892094b1d17147378f5e6a (patch) | |
tree | 675a502c57db5ffe0beefe4b39d7e5c111ef7e53 | |
parent | 5a0603ed72cead424a34b3bc5af3a5b1629ac187 (diff) | |
download | caddy-788462bd4c9c332b3f892094b1d17147378f5e6a.tar.gz caddy-788462bd4c9c332b3f892094b1d17147378f5e6a.zip |
file-server command: Use safer defaults; http: improve host matcher docs
-rw-r--r-- | modules/caddyhttp/fileserver/command.go | 8 | ||||
-rw-r--r-- | modules/caddyhttp/matchers.go | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/modules/caddyhttp/fileserver/command.go b/modules/caddyhttp/fileserver/command.go index e7a0ee389..e55318204 100644 --- a/modules/caddyhttp/fileserver/command.go +++ b/modules/caddyhttp/fileserver/command.go @@ -19,6 +19,7 @@ import ( "flag" "log" "strconv" + "time" "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig" @@ -32,7 +33,7 @@ func init() { caddycmd.RegisterCommand(caddycmd.Command{ Name: "file-server", Func: cmdFileServer, - Usage: "[--domain <example.com>] [--path <path>] [--listen <addr>] [--browse]", + Usage: "[--domain <example.com>] [--root <path>] [--listen <addr>] [--browse]", Short: "Spins up a production-ready file server", Long: ` A simple but production-ready file server. Useful for quick deployments, @@ -83,7 +84,10 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { } server := &caddyhttp.Server{ - Routes: caddyhttp.RouteList{route}, + ReadHeaderTimeout: caddy.Duration(10 * time.Second), + IdleTimeout: caddy.Duration(30 * time.Second), + MaxHeaderBytes: 1024 * 10, + Routes: caddyhttp.RouteList{route}, } if listen == "" { if certmagic.HostQualifies(domain) { diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 6c441089a..40a767fea 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -34,6 +34,16 @@ import ( type ( // MatchHost matches requests by the Host value (case-insensitive). + // + // When used in an HTTP route, + // [qualifying domain names](/docs/automatic-https#hostname-requirements) + // may trigger [automatic HTTPS](/docs/automatic-https), which automatically + // provisions and renews certificates for you. Before doing this, you + // should ensure that DNS records for these domains are properly configured, + // especially A/AAAA pointed at your server. + // + // Automatic HTTPS can be + // [customized or disabled](/docs/json/apps/http/servers/automatic_https/). MatchHost []string // MatchPath matches requests by the URI's path (case-insensitive). |