-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fileserver: Add disable_canonical_uris
Caddyfile subdirective
#4222
Conversation
add 'canonical_uris' parameter to caddyfile reference caddyserver#2741 Signed-off-by: mritd <mritd@linux.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch! This was an oversight when Caddyfile support was added to file_server
early on it seems.
I think the UX of this option isn't consistent with other boolean options. Since CanonicalURIs
being true is the same as being unset/nil (since the default is to enable the canonicalization redirects), I think the Caddyfile option should be called disable_canonical_uris
and the argument should be removed.
Also, please add a Caddyfile adapt test (or update an existing one) to cover this option. See https://github.com/caddyserver/caddy/tree/master/caddytest/integration/caddyfile_adapt
canonical_uris
Caddyfile subdirective
…nical_uris rename subdirective canonical_uris to disable_canonical_uris Signed-off-by: mritd <mritd@linux.com>
add disable_canonical_uris subdirective test file Signed-off-by: mritd <mritd@linux.com>
Thanks for your reply, I have modified the subdirective UX, but I still have a question: Is it necessary to add strict parameter verification here? case "disable_canonical_uris":
if h.NextArg() {
return nil, h.ArgErr()
} |
Not necessary, but it's a nice to have to make sure invalid configs are rejected. If it's rejected, we know for sure nobody used an argument, so in the future if we want to add an argument for whatever reason, it wouldn't be a possibly breaking change. |
Okay thank you 😁 |
canonical_uris
Caddyfile subdirectivedisable_canonical_uris
Caddyfile subdirective
disable_canonical_uris
Caddyfile subdirectivedisable_canonical_uris
Caddyfile subdirective
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this'll probably come in handy.
add 'canonical_uris' parameter to caddyfile
reference #2741
Signed-off-by: mritd mritd@linux.com