Revisiting the long-overdue "TODO always gunzip" in ngx_http_gunzip_filter_module.c
Maxim Dounin
mdounin at mdounin.ru
Mon Oct 21 18:39:09 UTC 2019
Hello!
On Mon, Oct 21, 2019 at 12:49:38PM -0500, J.R. wrote:
> > Also note that if you really need to force gunziping for some reason,
> > you can do so out of the box by using an additional local proxying
> > layer with appropriate "proxy_set_header Accept-Encoding".
>
> Yes, that is how I had it configured before patching, all content
> between nginx and the upstream servers was uncompressed using the
> directive you mentioned, but the goal was to have the data between the
> two servers compressed to reduce network traffic.
Well, it looks like I've failed to explain. You can have things
compressed between servers and then decompressed on the frontend
server. To do so, you can configure additional proxying on the
frontend server, for example:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Accept-Encoding "";
}
}
server {
listen 8080;
server_name gunzip.example.com;
location / {
proxy_pass http://backend;
proxy_set_header Accept-Encoding "gzip";
gunzip on;
}
}
With such a configuration all traffic between the frontend server
and the backend servers can be compressed using gzip. Yet
everything in the first server block isn't compressed, and can be
processed by sub filter and so on.
> Yes, I also read your comments from 2013, but after looking over the
> current gunzip module code, I can't find any flag that another module
> could set to force decompression? Or did I miss it buried somewhere?
It wasn't implemented. Rather, it is something I think should be
implemented if we want to process/modify compressed responses
within nginx.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list