Google Cloud HTTP Balancer和gzip [英] Google Cloud HTTP Balancer and gzip

查看:94
本文介绍了Google Cloud HTTP Balancer和gzip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Google Cloud Network Load Balancer时,我所有的HTTP gzip连接均保持不变,但是当使用HTTP/S Load Balancer时,最终用户无法获得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.

我在VM上使用nginx.使用此curl示例:

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

直接连接到VM时得到Content-Encoding: gzip,而连接到HTTP负载平衡器时没有gzip.

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

我已经在所有Google云文档中进行了搜索,他们没有提及他们是否支持或不压缩来自后端的内容.

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.

推荐答案

Google Cloud HTTP/S负载均衡器支持来自后端的压缩内容.但是,通过负载平衡器代理的请求将具有通过:google 1.1 '标头已添加.默认的nginx配置不信任代理能够处理压缩后的响应.解决方案是启用 gzip_proxied .

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.

这篇关于Google Cloud HTTP Balancer和gzip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆