Google Cloud CDN的缓存命中率为0%

Bhe*_*lic 2 cdn google-cloud-platform google-cloud-cdn

我是CDN的新手,两天前,我将我的Wordpress网站移到了Google Cloud Platform GCE。我已经有启用CDN的负载均衡器,但是“缓存命中率”为0%,并且没有移动。

我的网站是https://cryptstorm.com

我使用此工具https://www.giftofspeed.com/cache-checker/进行了检查,看来Cache-control和ETags正常工作,但CDN似乎不工作。我还在这里https://www.cdnplanet.com/tools/cdnfinder/#site:https://cryptstorm.com进行了检查 ,大多数请求都直接发送到该站点。

我在做什么错,如何使CDN正常​​工作?

小智 6

运行命令“ $ curl -sSL -D- https: //cryptstorm.com -o / dev / null”后,将显示以下标头输出:

> HTTP/2 200 date: Tue, 10 Jul 2018 07:46:15 GMT content-type:
> text/html; charset=UTF-8 set-cookie:
> __cfduid=db3de46de5278430e9a9c1ba1d14f642b1531208774; expires=Wed, 10-Jul-19 07:46:14 GMT; path=/; domain=.cryptstorm.com ; HttpOnly;
> Secure x-powered-by: PHP/7.0.30 x-cf-powered-by: WP Rocket 3.0.5 link:
> <https://cryptstorm.com/wp-json/>; rel="https://api.w.org/"
> x-frame-options: SAMEORIGIN x-mod-pagespeed: 1.9.32.14-0 vary:
> Accept-Encoding cache-control: max-age=0, no-cache via: 1.1 google
> alt-svc: clear expect-ct: max-age=604800,
> report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
> server: cloudflare cf-ray: 43816a5b1986a857-CDG
Run Code Online (Sandbox Code Playgroud)

我们可以专注于这一行:

“缓存控制:max-age = 0,无缓存”

这说明未为网页https://cryptstorm.com设置缓存,即使最长使用时间为0秒。尝试修改它,然后再次检查。

文档中,我们可以阅读以下内容:

“如果满足以下任一条件,则不会缓存响应:

·它具有Cache-Control:无存储,无缓存或专用指令。”

如果仍然无法解决问题,建议您向Google Cloud Support开一个案例,因为他们将提供有关VPC中CDN的配置方式以及可能配置错误的信息。