Browse Source

headers: Trim any trailing colon from field names as a courtesy

master
Matthew Holt 5 years ago
parent
commit
37aa516a6e
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 6
      modules/caddyhttp/headers/caddyfile.go

6
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()

Loading…
Cancel
Save