Trim quotes from proxy_set_header header name

This commit is contained in:
Cristian Baldi
2026-05-22 10:06:05 +02:00
committed by GitHub
parent d58fd9ac89
commit 743a63369c
2 changed files with 10 additions and 1 deletions
@@ -393,7 +393,7 @@ func createProxySetHeaderAction(d config.IDirective) (action, error) {
return nil, errors.New("proxy_set_header directive requires 2 parameters (header and value)")
}
key := params[0].String()
key := trimQuote(params[0].String())
val := trimQuote(params[1].String())
return func(rw http.ResponseWriter, req *http.Request, ctx *actionContext) (bool, error) {
@@ -399,6 +399,15 @@ proxy_set_header Accept-Encoding "";
"Accept-Encoding",
},
},
{
desc: "proxy_set_header with quoted header name",
configurationSnippet: `
proxy_set_header "X-Custom-Header" "my-value";
`,
expectedRequestHeaders: map[string]string{
"X-Custom-Header": "my-value",
},
},
{
desc: "set directive creates variable",
configurationSnippet: `