Cloudflare not respecting cdn cache headers

Hi, on my website I've set Cache-Control to public, s-maxage=3600 and Vary to Cookie, Accept-Encoding, because I wanna cache landing page for 5 minutes, but Cookie, Accept-Encoding seems to be always DYNAMIC. I don't see any option I could change in dashboard, am I doing something wrong or understanding wrong? https://cdn.ismcserver.online/NVIDIA_Overlay_5oSZAR9AgT.png
5 Replies
Chaika
Chaika5mo ago
Cloudflare will never cache html by default unless you make a cache rule telling it to do so, and if you do, Cookie headers will be thrown away, CF doesn't respect vary by cookie You could make a cache rule that doesn't cache if cookies are sent
.imexoodeex
.imexoodeexOP5mo ago
oh damn okay tanks
.imexoodeex
.imexoodeexOP5mo ago
Does is apply to url extension? I have another route that has no .png extension, but it has Content Type header set to image/png and it also doesn't seem to cache it. https://cdn.ismcserver.online/chrome_FCscspf8cb.png
DarkDeviL
DarkDeviL5mo ago
The default cache is by extension, - so if you want to cache "/widget" (and not "/widget.png"), I would say you need a cache rule. https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions
Cloudflare only caches based on file extension and not by MIME type.
Want results from more Discord servers?
Add your server