ry
ry
CDCloudflare Developers
Created by Sean on 3/4/2025 in #pages-help
Caching issue with Custom Domain for preview branches
Oh also worth noting we don't have any custom caching rules and have tried cache purging everything, which didn't work
3 replies
CDCloudflare Developers
Created by Sean on 3/4/2025 in #pages-help
Caching issue with Custom Domain for preview branches
Hi, we've also started running into what sounds like the exact same issue. We have custom domains pointed at pages deployments as follows: <domain> -> client-<page-name>.pages.dev (prod) dev.<domain> -> dev.client-<page-name>.pages.dev (staging) The cloudflare provided page urls work fine, but on the dev domain there are a number of files that can't be found and return our index.html. This is leading to a bunch of errors where our code receives html but is expecting a different data type: Refused to execute script from <js-file> because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. ChunkLoadError: Loading chunk <chunk-num> failed. SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
- Sometimes the file request returns with 404 status when a file only exists on the preview branch but has not made it to prod - Sometimes the file request returns the prod version of the file instead of the dev or staging version. For example one of our bundle files is statically named: service-worker.js. And we have a unique identifier inside of it per release which allows us to confirm we're getting the prod file when we should be getting the preview version.
This is a really interesting observation and makes me feel better that it's hopefully just an issue with our dev subdomain🤞 Nearly all of our files that have changes get a new hashed name so I was only noticing the 404 case, but it would make sense if it's trying to request files that don't exist on prod. These issues only started a few days ago for us. We've had this setup for over 2 years and have never run into anything like this. Did something change recently? @Sean were you able to figure this out? If not, some outside help would be greatly appreciated 😄
3 replies