gzip compression for upstream requests

Dmitry Vereschaka dmitry at xdmitry.ru
Thu Oct 10 14:12:40 UTC 2019


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


More information about the nginx mailing list