why nginx is not compressing reply from proxied server?

Peter Volkov peter.volkov at gmail.com
Tue May 11 15:16:46 UTC 2021


Err, After few hours of debugging, and writing email here, I've realised
that I have `gzip off;` in http {} block of configuration. After enabling
gzip in http block everything works fine. Is it correct behaviour that no
warning is issued with such configuration?

--
Peter.


On Tue, May 11, 2021 at 6:09 PM Peter Volkov <peter.volkov at gmail.com> wrote:

> Hi, I have a HTTP/1.0 web server that streams chunked content to clients.
> It does not gzip content so I would like to use nginx as reverse proxy to
> compress output from this server. Yet, no matter what I do nginx is not
> compressing results. For nginx I'm using following config:
>
> server {
>     gzip on;
>     gzip_comp_level 5;
>     gzip_http_version 1.0;
>     gzip_buffers 4 32k;
>     gzip_min_length 0;
>     gzip_types application/octet-stream;
>     gzip_proxied any;
>     gzip_vary on;
>
>     proxy_buffering off;
>
>     location / {
>         proxy_pass http://10.239.254.17:9102;
>     }
> }
>
> Then I'm using curl to request content:
>
> curl -v IP:9202 -H 'Accept-Encoding: deflate, gzip' -o output
> =====================================================
> > GET / HTTP/1.1
> > Host: IP:9202
> > User-Agent: curl/7.76.1
> > Accept: */*
> > Accept-Encoding: deflate, gzip
> >
> * Mark bundle as not supporting multiuse
> < HTTP/1.1 200 OK
> < Server: nginx/1.17.5
> < Date: Tue, 11 May 2021 15:05:56 GMT
> < Content-Type: application/octet-stream
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> < Keep-Alive: timeout=20
> < Accept-Ranges: none
> < Cache-Control: no-cache
> <
> { [672 bytes data]
> 100 3343k    0 3343k    0     0  4866k      0 --:--:-- --:--:-- --:--:--
> 4859k^C
> =====================================================
>
> In result output is not compressed. What may cause this behaviour?
>
> This is how request/respond to downstream server looks like:
>  curl -v http://10.239.254.17:9102
> *   Trying 10.239.254.17:9102...
> * TCP_NODELAY set
> * Connected to 10.239.254.17 (10.239.254.17) port 9102 (#0)
> > GET / HTTP/1.1
> > Host: 10.239.254.17:9102
> > User-Agent: curl/7.66.0
> > Accept: */*
> >
> * Mark bundle as not supporting multiuse
> * HTTP 1.0, assume close after body
> < HTTP/1.0 200 OK
> < Server: UDP to HTTP tool with smart buffering
> < Accept-Ranges: none
> < Content-type: application/octet-stream
> < Cache-Control: no-cache
>
>
> Thanks in advance for any help,
> --
> Peter.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210511/1d073fc7/attachment.htm>


More information about the nginx mailing list