0

I have the following declared in my server block in my nginx config to serve my Next.js app:

location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    location ~* \.(?:ico|gif|jpg|jpeg|png)$ {
        expires 2d;
        add_header Pragma public;
        add_header Cache-Control "public";
    }

Then in my nginx.conf I have the following enabled for gzip:

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon

However when I test this with a curl request as in:

curl -H "Accept-Encoding: gzip" -I https://mywebsite.com/productimages/5e32c780e1b6a5.89124769.jpg

I do not see:

Content-Encoding: gzip

The result I get is this:

HTTP/1.1 200 OK
Server: nginx/1.15.9 (Ubuntu)
Date: Thu, 30 Jan 2020 21:00:53 GMT
Content-Type: image/jpeg
Content-Length: 88193
Last-Modified: Thu, 30 Jan 2020 12:09:37 GMT
Connection: keep-alive
ETag: "5e32c781-15881"
Accept-Ranges: bytes

Could someone help me get this going/see's the mistake?

strangeQuirks
  • 4,761
  • 9
  • 40
  • 67

0 Answers0