brdwvs
May 27, 2022, 8:49pm
#1
I have this page rule:
mysite.com/*
Cache Level: Cache Everything, Automatic HTTPS Rewrites: On, Origin Cache Control: On
When accessing a page, I get this response:
HTTP/1.1 200 OK
CF-Cache-Status: BYPASS
CF-RAY: 712199519f259ac3-MIA
Cache-Control: s-max-age=1800
Cdn-Cache-Control: public, max-age=840000
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Fri, 27 May 2022 20:46:16 GMT
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Envoy-Upstream-Service-Time: 942
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
How can I get Cloudflare to respect the CDN-Cache-Control
header and cache the page?
Do you have any firewall rules that are enabled for bypass?
1 Like
brdwvs
May 27, 2022, 9:00pm
#3
No, I’m not using the Firewall Rules feature of Cloudflare.
From the docs BYPASS is set when
The origin server instructed Cloudflare to bypass cache via a Cache-Control header set to no-cache
, private
, or max-age=0
even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control . Cloudflare also sets BYPASS when your origin web server sends cookies in the response header.
I would check to see if any of those conditions are met
https://developers.cloudflare.com/cache/about/default-cache-behavior/#cloudflare-cache-responses
2 Likes
Might not be related, but it is s-maxage
.
2 Likes
brdwvs
May 27, 2022, 9:44pm
#6
I’ve looked into that. The response headers I shared above show that none of that should be a problem, hence my confusion. Any other ideas?
brdwvs
May 27, 2022, 9:57pm
#7
Thanks! Alas, it made no difference with the cache bypass issue.
brdwvs
May 27, 2022, 9:58pm
#8
I’m using Render , which happens to use Cloudflare for DDOS protection (but not caching). Maybe that has something to do with it?
M4rt1n
May 27, 2022, 10:29pm
#10
May you share your domain? It’s hard to help people, without seeing the real page.
1 Like
brdwvs
May 27, 2022, 10:56pm
#11
Ok so, I’ve determined it’s related to my use of Render as a host for my origin server.
If I use my router’s public IP, the cf-cache-status is MISS as desired.
brdwvs
May 31, 2022, 8:53am
#12
In case someone hits the same issue, the solution is to use a CNAME record on root instead of an A record , and point it to the onrender.com
subdomain related to your project.