title: Google cloud load balancer not returning Content-Encoding: gzip
body: <p>I'm using google cloud Load balancer that sits in front of an nginx backend service (in google cloud terms).</p>
  
  <p><strong>When i'm accessing the nginx server directly i can see the 'Content-Encoding: gzip' header (left side).</strong></p>
  
  <p><strong>But the response from the Load balancer doesn't contain this header (right side).</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/EsauE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EsauE.png" alt="enter image description here"></a></p>
  
  <p>I've enabled gzip_proxied in my nginx configuration file:</p>
  
  <pre><code>server {
  
     listen 80;
      gzip on;
      gzip_vary on;
      gzip_proxied any;  // &lt;------ 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;
      }
  }
  </code></pre>
  
  <p>Relevant link that did not worked:</p>
  
  <p><a href="https://stackoverflow.com/questions/35947469/google-cloud-http-balancer-and-gzip">Google Cloud HTTP Balancer and gzip</a></p>
  
  <p>Any ideas?</p>