[英]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.