How to Specify a Vary: Accept-Encoding header Nginx

| Drupal Development | 67 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.

 

Latest articles

Berlin Zoo and Aquarium: One of the Best Things To Do in Berlin With Kids

At the start of April 2026, during our roughly five-day trip to Berlin, we finally visited the famous Berlin Zoo for the first time - or at least the first time I can actually remember. There is a chance my mom might have taken me here sometime in the early 1990s, but if so, those memories are long gone. This visit felt completely new, and…

Germany |

Berlin Brandenburg Airport

In April 2026, I had my first experience with Berlin Brandenburg Airport (BER) while flying the Riga–Berlin–Riga route with airBaltic. This was my first time using Berlin’s main international airport, and overall, it left a solid impression—modern, functional, and relatively easy to navigate. About a decade ago, I had the chance to travel through…

Germany |