I have tried various settings available for Nginx.conf, none of them are working for me. Below id my current config, gzip on; gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
gzip_min_length 256;
gzip_buffers 16 8k;
gzip_http_version 1.1;
# gzip_types text/plain text/css application/json charset=utf-8 application/javascript text/xml application/xml application/xml+rss text/javascript json;
gzip_types application/json;
But when I hit an endpoint to get the response from POSTMAN app it shows Content-Encoding →gzip
in response headers but the response size is still the same. Below is the list of all headers received in response.
Content-Type →application/json; charset=utf-8
Transfer-Encoding →chunked
Connection →keep-alive
Vary →Accept-Encoding
Vary →Origin
Status →200 OK
Cache-Control →max-age=0, private, must-revalidate
ETag →W/"f72af3bd9d87210025b3033805735ee6"
X-Runtime →0.135639
X-Request-Id →f2efd718-89d7-4351-a79c-721e9312ea82
Date →Thu, 12 Dec 2019 13:10:32 GMT
X-Powered-By →Phusion Passenger 6.0.2
Server →nginx/1.15.8 + Phusion Passenger 6.0.2
Content-Encoding →gzip
Can anyone suggest any solutions ?
One more point, when I bypass the Nginx and run the rails server with "config.middleware.use Rack::Deflater" in application.rb I am able to see compression in response size.
My server configuration below, Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial
Nginx version, nginx version: nginx/1.15.8
Thanks for your help.