How to Specify a Vary: Accept-Encoding header Nginx

| Servers | 23 seen

The other day I visited tools.pingdom.com to test performance for my blog (the one you are currently reading) and I did fine I have a two bottlenecks:

I managed to handle query string issue for static resources and then I headed to find a solution for the Specify a Vary thing. Since it's not a Drupal related issue I did some search regarding Nginx and I soon found excellent solution on stackoverflow.com

How to Specify a Vary: Accept-Encoding header Nginx 

Inside the server { of the domain/subdomain that you want to set it, add

sudo nano /path/to/domain/sites-available/yourdomain.com

gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;

Save the file (CTRL-O and CTRL - X)  and restart Nginx (sudo /etc/init.d/nginx restart)

I managed to improve my performance score from 82 to 88 on tools.pingdom.com after this.

Add new comment