Reputation: 757
I have 5 micro-services that are up and running. One of them is an nginx server that acts as a gateway( reverse proxy for other services). There is another service called 'web' that is an nginx server that serves all the client side static bundles. I have enabled gzipping in the web nginx server. But when the compressed response comes through the gateway nginx server, it decompresses the files and sends them back to the client. I tried setting gzip off
and gunzip off
in gateway nginx server but it is not working.
Here is the configuration of the web-nginx server:
gzip on;
gzip_comp_level 3;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_min_length 100;
gzip_buffers 4 32k;
Here is the configuration for the gateway ngnix server:
gzip off;
gunzip off;
Any kind of help is appreciated.
Upvotes: 1
Views: 828
Reputation: 757
I found the mistake that, i failed to forward the header using proxy_pass
from proxy server to actual server. With help of above answer. it worked.
Upvotes: 0
Reputation: 3194
You need to add gzip_proxied any;
to the backend nginx servers (serving static files)
Compress data even for clients that are connecting to us via proxies, identified by the "Via" header (required for CloudFront/Cloudflare).
The default value is off which disables compression for all proxied requests, ignoring other parameters; For more info checkout the nginx docs
Upvotes: 2