@marcel91200 / caddy Mirror · read-only / commits / 37aa516a
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

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

Matthew Holt committed Mar 30, 2020 at 11:52 UTC 37aa516a6eb5346f5cdcd0ee6a4ec1784c073f54
1 file changed +6
modules/caddyhttp/headers/caddyfile.go
+6
@@ -111,6 +111,12 @@ func parseReqHdrCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler,
111 return nil, h.ArgErr()
112 }
113 field := h.Val()
114 +
115 + // sometimes it is habitual for users to suffix a field name with a colon,
116 + // as if they were writing a curl command or something; see
117 + // https://caddy.community/t/v2-reverse-proxy-please-add-cors-example-to-the-docs/7349
118 + field = strings.TrimSuffix(field, ":")
119 +
120 var value, replacement string
121 if h.NextArg() {
122 value = h.Val()