gzip compression for upstream requests

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gzip compression for upstream requests

Dmitry Vereschaka
Hi

Does nginx support compression of proxied upstream requests (not
responses)?

I have configuration below and what I see is that responses are sent
uncompressed to upstream server (and I'm getting compressed responses from
upstream, as upstream is also nginx with gzip compression enabled).

upstream someupstream {
      server someserver:3333;
      keepalive 32;
}

server {
      listen 3333;
      gzip on;
      gzip_proxied any;
      gzip_types *;
      gzip_min_length 10;
      gzip_vary on;
      gzip_http_version 1.1;

      location / {
          proxy_pass http://someupstream;
          proxy_read_timeout 84600s;
          proxy_send_timeout 84600s;
          proxy_http_version 1.1;
          proxy_set_header Connection "";
      }
}

when I do curl --data-binary @file.txt http://localhost:3333/zxc

I can see with tcpdump that following data is sent to upstream server

POST /zxc HTTP/1.1
Host: someupstream
Content-Length: 4301
Accept: */*
Content-Type: application/x-www-form-urlencoded

<content of the file here>

Regards
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: gzip compression for upstream requests

Maxim Dounin
Hello!

On Thu, Oct 10, 2019 at 05:12:40PM +0300, Dmitry Vereschaka wrote:

> Does nginx support compression of proxied upstream requests (not
> responses)?

No.

> I have configuration below and what I see is that responses are sent

Just a side note: you probably mean "requests" here.

> uncompressed to upstream server (and I'm getting compressed responses from
> upstream, as upstream is also nginx with gzip compression enabled).

Quoting documentation of the gzip directive
(http://nginx.org/r/gzip):

: Enables or disables gzipping of responses.

Similar wording can be found in the module description above.  
It's about responses, not requests.

[...]

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: gzip compression for upstream requests

Dmitry Vereschaka
Thank you!

On Thu, Oct 10, 2019 at 6:05 PM Maxim Dounin <[hidden email]> wrote:
Hello!

On Thu, Oct 10, 2019 at 05:12:40PM +0300, Dmitry Vereschaka wrote:

> Does nginx support compression of proxied upstream requests (not
> responses)?

No.

> I have configuration below and what I see is that responses are sent

Just a side note: you probably mean "requests" here.

Yes, thank you!
 

> uncompressed to upstream server (and I'm getting compressed responses from
> upstream, as upstream is also nginx with gzip compression enabled).

Quoting documentation of the gzip directive
(http://nginx.org/r/gzip):

: Enables or disables gzipping of responses.

Similar wording can be found in the module description above. 
It's about responses, not requests.

[...]

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx