diff options
author | mritd <[email protected]> | 2021-07-02 07:22:16 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-01 17:22:16 -0600 |
commit | 4245ceb67d1a40ce7a691bcf85e143218e5c458c (patch) | |
tree | 9b9a825737aaaa611ade0a15b3a31d1ea99eda14 /modules/caddyhttp/fileserver/caddyfile.go | |
parent | 0bdb8aa82d7cef64dae3f75f19c680922237e658 (diff) | |
download | caddy-4245ceb67d1a40ce7a691bcf85e143218e5c458c.tar.gz caddy-4245ceb67d1a40ce7a691bcf85e143218e5c458c.zip |
fileserver: Add `disable_canonical_uris` Caddyfile subdirective (#4222)
* feat(fileserver): add 'canonical_uris' parameter to caddyfile
add 'canonical_uris' parameter to caddyfile
reference #2741
Signed-off-by: mritd <[email protected]>
* feat(file_server): rename subdirective canonical_uris to disable_canonical_uris
rename subdirective canonical_uris to disable_canonical_uris
Signed-off-by: mritd <[email protected]>
* test(caddyfile_adapt): add disable_canonical_uris subdirective test file
add disable_canonical_uris subdirective test file
Signed-off-by: mritd <[email protected]>
Diffstat (limited to 'modules/caddyhttp/fileserver/caddyfile.go')
-rw-r--r-- | modules/caddyhttp/fileserver/caddyfile.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go index 447f4811c..886d6672c 100644 --- a/modules/caddyhttp/fileserver/caddyfile.go +++ b/modules/caddyhttp/fileserver/caddyfile.go @@ -41,6 +41,7 @@ func init() { // browse [<template_file>] // precompressed <formats...> // status <status> +// disable_canonical_uris // } // func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) { @@ -112,6 +113,13 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) } fsrv.StatusCode = caddyhttp.WeakString(h.Val()) + case "disable_canonical_uris": + if h.NextArg() { + return nil, h.ArgErr() + } + falseBool := false + fsrv.CanonicalURIs = &falseBool + default: return nil, h.Errf("unknown subdirective '%s'", h.Val()) } |