Disable br compression when no Accept-Encoding header is present

This commit is contained in:
Robin Moser 2024-01-16 15:30:06 +01:00 committed by GitHub
parent 81ce45271d
commit 7a315bb043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View file

@ -92,11 +92,11 @@ func (c *compress) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
return
}
// Client allows us to do whatever we want, so we br compress.
// See https://www.rfc-editor.org/rfc/rfc9110.html#section-12.5.3
// Client doesn't specify a preferred encoding, for compatibility don't encode the request
// See https://github.com/traefik/traefik/issues/9734
acceptEncoding, ok := req.Header["Accept-Encoding"]
if !ok {
c.brotliHandler.ServeHTTP(rw, req)
c.next.ServeHTTP(rw, req)
return
}