Minor tweaks

This commit is contained in:
Matthew Holt 2020-03-13 13:02:47 -06:00
parent c447236357
commit 6cbd93736f
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
7 changed files with 23 additions and 17 deletions

View file

@ -40,10 +40,10 @@ demos, and development.
The listener's socket address can be customized with the --listen flag.
If a qualifying hostname is specified with --domain, the default listener
address will be changed to the HTTPS port and the server will use HTTPS
if domain validation succeeds. Ensure A/AAAA records are properly
configured before using this option.
If a domain name is specified with --domain, the default listener address
will be changed to the HTTPS port and the server will use HTTPS. If using
a public domain, ensure A/AAAA records are properly configured before
using this option.
If --browse is enabled, requests for folders without an index file will
respond with a file listing.`,
@ -89,7 +89,11 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) {
Routes: caddyhttp.RouteList{route},
}
if listen == "" {
listen = ":" + strconv.Itoa(certmagic.HTTPSPort)
if domain == "" {
listen = ":80"
} else {
listen = ":" + strconv.Itoa(certmagic.HTTPSPort)
}
}
server.Listen = []string{listen}

View file

@ -51,7 +51,7 @@ default, all incoming headers are passed through unmodified.)
`,
Flags: func() *flag.FlagSet {
fs := flag.NewFlagSet("file-server", flag.ExitOnError)
fs.String("from", "", "Address on which to receive traffic")
fs.String("from", "localhost:443", "Address on which to receive traffic")
fs.String("to", "", "Upstream address to which to to proxy traffic")
fs.Bool("change-host-header", false, "Set upstream Host header to address of upstream")
return fs