I'm using google cloud Load balancer that sits in front of an nginx backend service (in google cloud terms).
When i'm accessing the nginx server directly i can see the 'Content-Encoding: gzip' header (left side).
But the response from the Load balancer doesn't contain this header (right side).
I've enabled gzip_proxied in my nginx configuration file:
server {
listen 80;
gzip on;
gzip_vary on;
gzip_proxied any; // <------ Here
gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
gzip_static on;
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
try_files $uri $uri/ /index.html;
}
}
Relevant link that did not worked:
Google Cloud HTTP Balancer and gzip
Any ideas?

gzip_static always, possibly even in theserverand not thelocation. - Martin Zeitler