Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud HTTP Balancer and gzip

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.

like image 408
jordi Avatar asked Mar 11 '16 18:03

jordi


People also ask

What is HTTP load balancer in GCP?

External HTTP(S) Load Balancing is a proxy-based Layer 7 load balancer that enables you to run and scale your services behind a single external IP address.

What are the three categories of GCP load balancing?

HTTP and HTTPS traffic:Global external HTTP(S) load balancer (classic) Regional external HTTP(S) load balancer. Internal HTTP(S) load balancer.

Does Google have a single load balancer?

Google Cloud offers the following load balancing features: Single anycast IP address. With Cloud Load Balancing, a single anycast IP address is the frontend for all of your backend instances in regions around the world.

How do I enable gzip compression in Chrome?

In your browser: In Chrome, open the Developer Tools > Network Tab (Firefox/IE will be similar). Refresh your page, and click the network line for the page itself (i.e., www.google.com ). The header “Content-encoding: gzip” means the contents were sent compressed.


1 Answers

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.

like image 95
Matt S. Avatar answered Sep 18 '22 13:09

Matt S.