Google Cloud HTTP Balancer and gzip

2019-06-17 19:09发布

问题:

When i was using Google Cloud Network Load Balancer all my HTTP gzip connections where left intact, but when using HTTP/S Load Balancer end users don't get the gzipped content.

I'm using nginx on the VM. Using this curl example:

curl -H "Accept-Encoding: gzip" -H "Host: my.website.com" -I https://$IP_TO_TEST/login --insecure

I get Content-Encoding: gzip when connecting direct to the VM and no gzip when I connect to the HTTP load balancer.

I've searched all the Google cloud documentation for this and they don't mention whether they support or don't gzipped content from backends.

回答1:

The Google Cloud HTTP/S load balancer supports gzipped content from backends. However, requests proxied through the load balancer will have a 'Via: google 1.1' header added. The default nginx configuration does not trust proxies to be able to handle gzipped responses. The solution is to enable gzip_proxied.



回答2:

The HTTP/S load balancer supports gzipped content from backends. Do you have an example of request and response headers you could share? What are you running on the VM (nginx, Apache)?