fix(plugin/caddy): handle disable_query directive
frederichoule opened this issue · comments
Frederic Houle commented
We added the option to disable query string in keys (#319), which seemed to work according to the tests in context/key_test.go
, but in real life situation it doesn't seem to work.
For example, a test in plugins/caddy/httpcache_test.go
still appends the query string to the key.
func TestQueryString(t *testing.T) {
tester := caddytest.NewTester(t)
tester.InitServer(`
{
admin localhost:2999
order cache before rewrite
http_port 9080
https_port 9443
cache {
key {
disable_query
}
}
}
localhost:9080 {
route /cache-default {
cache
respond "Hello, default!"
}
}`, "caddyfile")
resp1, _ := tester.AssertGetResponse(`http://localhost:9080/cache-default?query=string`, 200, "Hello, default!")
if resp1.Header.Get("Cache-Status") != "Souin; fwd=uri-miss; stored; key=GET-http-localhost:9080-/cache-default" {
t.Errorf("unexpected Cache-Status header %v", resp1.Header)
}
}
Results:
unexpected Cache-Status header map[Cache-Control:[] Cache-Status:[Souin; fwd=uri-miss; stored; key=GET-http-localhost:9080-/cache-default?query=string]