An app of mine has nginx as a webserver, and I'm using gzip compression. I've checked gzip integrity via https://checkgzipcompression.com/ - it seems to be working A OK.

However, a lot of my users are accessing my website via a forward proxy. How can I test whether gzip is working correctly for those users as well? Please ask for more information as required.

In nginx.conf, some relevant lines are:

gzip on;
gzip_disable "msie6";
gzip_proxied expired no-cache no-store private auth;
gzip_comp_level 2;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

You can enable logging of gzip compression, example:

http {
    log_format compression '$remote_addr - $remote_user [$time_local] '
                           '"$request" $status $body_bytes_sent '
                           '"$http_referer" "$http_user_agent" "$gzip_ratio"';


    server {
        gzip on;
        access_log /spool/logs/nginx-access.log compression;

This way you can see the compression ratio per IP, so just grep for forward proxy IP's and check the ratio.

  • I already have a directive for access logging access_log /var/log/nginx/access.log; So I'll just need to customize my log_format, correct? – Hassan Baig Oct 24 '16 at 13:12
  • Yep, just add $gzip_ratio to your logging configuration, so you can see actually how much compression helps, and for which client ip – Fredi Oct 24 '16 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.