简体   繁体   English

谷歌云 CDN 后端服务负载均衡器不缓存任何资源

[英]Google cloud CDN backend service load balancer not caching any resources

We have a requirement to generate images on the fly and cache using CDN.我们需要使用 CDN 动态生成图像和缓存。 For this we have configured a backend service with a load balancer enabled cloud CDN.为此,我们使用启用了负载均衡器的云 CDN 配置了后端服务。 We are using Nginx proxy server.我们正在使用 Nginx 代理服务器。 We have added headers specified in the Google cloud CDN docs, but unfortunately it is not caching.我们添加了 Google Cloud CDN 文档中指定的标头,但不幸的是它没有缓存。

Request:要求:

GET /resize?size=l&url=https://example.com/image.jpeg HTTP/1.1
Host: resize.example.com

Request Headers:请求头:

Host: resize.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:70.0) Gecko/20100101 Firefox/70.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1

Response headers:响应头:

HTTP/1.1 200 OK
Server: nginx/1.17.2
Date: Wed, 15 Jan 2020 15:01:14 GMT
Content-Type: image/jpeg
Content-Length: 62771
cache-control: max-age=86400, public, s-maxage=86400
Via: 1.1 google

I suggest you a couple of pages that could help you.我建议你几页可以帮助你。

a) Not all HTTP responses are cacheable. a) 并非所有 HTTP 响应都可以缓存。 Cloud CDN caches only those responses that meet all the requirements in this section. Cloud CDN 仅缓存满足本部分所有要求的响应。 Some of these requirements are specified by RFC 7234, and others are specific to Cloud CDN.其中一些要求由 RFC 7234 指定,其他要求特定于 Cloud CDN。

Cacheability for HTTP responses HTTP 响应的可缓存性

Responses aren't being cached--Troubleshooting 未缓存响应--疑难解答

The following example demonstrates using curl to check the HTTP response headers for http://example.com/style.css :以下示例演示如何使用 curl 检查http://example.com/style.css的 HTTP 响应标头:

$ curl -s -D - -o /dev/null http://example.com/style.css HTTP/1.1 200 OK Date: Tue, 16 Feb 2016 12:00:00 GMT Content-Type: text/css Content-Length: 1977 Via: 1.1 google $ curl -s -D - -o /dev/null http://example.com/style.css HTTP/1.1 200 OK 日期:2016 年 2 月 16 日星期二 12:00:00 GMT 内容类型:text/css 内容-长度:1977 年通过:1.1 谷歌

Although perhaps because of the added response, you may have already read it.虽然可能是因为添加了回复,但您可能已经阅读了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 子域未映射到Google Cloud Compute Engine中的负载均衡器后端服务 - Subdomain not mapping to load balancer backend service in Google Cloud Compute Engine URL Map 不适用于负载均衡器 Google Cloud 上的后端服务 - URL Map is not working with backend service on Load Balancer Google Cloud 如何将tcp后端服务添加到现有的https负载均衡器谷歌云 - How to add tcp backend service to existing https load balancer google cloud 以Google App Engine为后端的Google Cloud Load Balancer上的GeoDNS路由 - GeoDNS routing on Google Cloud Load Balancer with Google App Engine as backend 使用来自其他项目的 NEG 作为 Google Cloud Load Balancer 后端 - Use NEGs from other project as Google Cloud Load Balancer backend 谷歌云负载均衡器动态添加后端存储桶 - Google cloud load balancer dynamically adding backend buckets 谷歌云负载均衡器 - Google Cloud Load Balancer Google Cloud CDN仅使用存储桶后端来缓存某些路径 - Google Cloud CDN is only caching some paths using storage bucket backend Google负载均衡器CDN 502错误 - Google Load Balancer CDN 502 Errors Kubernetes UDP服务未与Google Cloud Load Balancer一起运行 - Kubernetes UDP service not running with Google Cloud Load balancer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM