diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-30 11:52:11 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-30 11:52:11 -0600 |
commit | 37aa516a6eb5346f5cdcd0ee6a4ec1784c073f54 (patch) | |
tree | ca245bb43a359cd72e43ff396e64220fa1fea859 /modules | |
parent | 105acfa08664c97460a6fe3fb49635618be5bcb2 (diff) |
headers: Trim any trailing colon from field names as a courtesy
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/headers/caddyfile.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddyhttp/headers/caddyfile.go b/modules/caddyhttp/headers/caddyfile.go index e69c679..d893cab 100644 --- a/modules/caddyhttp/headers/caddyfile.go +++ b/modules/caddyhttp/headers/caddyfile.go @@ -111,6 +111,12 @@ func parseReqHdrCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, return nil, h.ArgErr() } field := h.Val() + + // sometimes it is habitual for users to suffix a field name with a colon, + // as if they were writing a curl command or something; see + // https://caddy.community/t/v2-reverse-proxy-please-add-cors-example-to-the-docs/7349 + field = strings.TrimSuffix(field, ":") + var value, replacement string if h.NextArg() { value = h.Val() |