I have nginx reverse proxy that receives brotli compressed response from upstream (Varnish cache). But, the reverse proxy serves brotli compressed response to browser only if I setup "brotli on;" within the reverse proxy server block.
My goal is to have the nginx reverse proxy not handle compression at all. To achieve this, I have following questions:
Is the reverse proxy block expected to un-compress the received response and handle it on it's own? Can't it directly pass the upstream response back to client?
Is there a way to dump proxy response or it's size to nginx logs? This shall help debug the issue better.
I have resolved this so posting this for anyone who may encounter similar issue:
gzip_http_version
is 1.0 while the default for proxy_http_version
is 1.1. (see here)Resolution was achieved by:
a. setting Varnish to not worry about compression by passing -p http_gzip_support=off
to varnishd
.
b. setting gzip_http_version
to 1.1
on the upstream Nginx server.
Deciphering the above behavior became possible because I logged the following on my upstream nginx server (the one behind varnish):
log_format bytes_sent '$bytes_sent' - '$http_accept_encoding' - '$request';