Pages root caching issue?

I have a Pages page setup, custom domains, and deployments working just fine – however CF seems to be aggressively caching the index route of only one custom domain in particular, instead serving a now-broken (outdated) index page that can't find any of its resources (since removed from the codebase). Any non-index routes work, even the index route with a query string works. I've tried purging the cache (many times!), I've given it 24 hours, i've tried removing the CNAME record and re-adding it... all to no avail. Interestingly, not only does the issue only exist for only ONE of several custom domains of the page, but the issue also only exists on ONE subdomain of that domain – www. fails while a blank subdomain (@ CNAME) works just fine. It's gotta be a caching issue, right? Any ideas how to shake it loose?
10 Replies
Chaika
Chaika2y ago
What's the domain name? You should be able to see is CF is caching that, by looking at the CF-Cache-Status, and the age header for how long. Pages has its own interrnal cache (not visible in those headers, but also wouldn't be causing this issuse), so it is usually recommended to disable the normal cache entirely if it's causing issues like this. If you already purged it though, it shouldn't be
Keiran
KeiranOP2y ago
the domain is www.investinlegion.com cf-cache-status shows as DYNAMIC
Chaika
Chaika2y ago
Interesting, it is dynamic properly, but there's an age header I get, about 70k seconds or 19 hours. Looks like you're using Remix, I'm not sure if you or Remix has some custom cache logic. You also have cache-control being set there which isn't default, with a max length of 7 days, probably from Remix or the headers file
Keiran
KeiranOP2y ago
hmm interesting – i'll dig around remix config a bit thank you for looking! so what seems to be happening here is cloudflare is holding onto a compiled index.html from the previous codebase that no longer exists in the new codebase (Remix), but i'm not sure how to go about flushing that out
Chaika
Chaika2y ago
It shouldn't be, Remix is SSR. Even if it was, it should happen on all custom domains, not just www. You don't happen to have anything like an HTTP Route/Worker Route on just the subdomain, or anything like that right?
Keiran
KeiranOP2y ago
none that i can find
thasmo
thasmo8mo ago
I've the exact same problem. Using Remix and it seems Cloudflare responds with a stale/old HTML version, but only for some requests randomly. Purged the CF cache several times; can't figure out where the old HTML is coming from. 🤔
Chaika
Chaika8mo ago
this thread was from almost a year ago, please make your own under #pages-help
thasmo
thasmo8mo ago
Oh, sure. Sorry, I thought I wouldn't pollute with a new thread, but I will. Thanks!
Chaika
Chaika8mo ago
side note, looking at this a year later, this specific issue was possiblity the Pages Asset Preservation Cache: https://developers.cloudflare.com/pages/configuration/serving-pages/
We will insert assets into the cache on a per-data center basis. Assets have a time-to-live (TTL) of one week but can also disappear at any time. If you do a new deploy, the assets could exist in that data center up to one week.
If you have an html file like index.html that exists in one build but not another, Asset Preservation cache will make it stick around. It can cause annoying issues with switching from a static site to an spa. It caches the exact url, so it could be just for www and not other Custom Domains, and it's not purgable via normal cache as it lives on the pages.dev May be entirely unrelated to your specific issue though, would need more info. I'll lock this thread as it's far ran its course

Did you find this page helpful?