Welcome! Log In Create A New Profile

Advanced

Re: why nginx is not compressing reply from proxied server?

Maxim Dounin
May 11, 2021 05:24PM
Hello!

On Tue, May 11, 2021 at 06:16:46PM +0300, Peter Volkov wrote:

> 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?

The configuration specified in http{} block applies, unless you've
redefined the configuration in more specific scope, such as
server{} or location{}. That is, the following configuration
won't use gzip:

http {
gzip off;

server {
listen 80;
}
}

But the following will:

http {
gzip off;

server {
listen 80;
gzip on;
}
}

That's how it is expected to work.

If a configuration with "gzip off;" at the http level and "gzip on;"
at the server level doesn't work for you, but changing it to "gzip
on;" at the http level works, most likely this means that you are
looking at the wrong server{} block.

Note that the configuration you've provided listens on the port 80
(the default):

> > 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;
> > }
> > }

And you are testing port 9102, not 80:

> > curl -v IP:9202 -H 'Accept-Encoding: deflate, gzip' -o output

Most likely this means that you are testing against the wrong
server{} block, and that's why "gzip on;" at http{} level works
for you.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

why nginx is not compressing reply from proxied server?

pva May 11, 2021 11:12AM

Re: why nginx is not compressing reply from proxied server?

pva May 11, 2021 11:18AM

Re: why nginx is not compressing reply from proxied server?

Maxim Dounin May 11, 2021 05:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready