Trouble with script loading

I'm having trouble with script loading from cdn.domain.com (R2) and Cloudflare pages on a custom domain which is domain.com (for example). On the url pages.dev, the scripts are correctly loaded from the CDN. Via the custom domain, it's as if they were in the public folder. Example: Page.dev domain: <link rel="stylesheet" type="text/css" href="https://cdn.domain.com/gpdr/tarteaucitron/css/tarteaucitron.css?v=20220322"> Custom domain: <link rel="stylesheet" type="text/css" href="/css/tarteaucitron.css?v=20220322"> Page.dev domain: <script id="" async="" src="https://cdn.domain.com/gpdr/tarteaucitron/lang/tarteaucitron.fr.js?v=20220322"></script> Custom domain: <script id="" async="" src="/lang/tarteaucitron.fr.js?v=20220322"></script> I only have a rule with a 301 to redirect from domain.com to www.domain.com (see screenshot). I must admit that I am lost and I do not understand. Do you have any ideas?
3 Replies
Walshy
Walshy12mo ago
that's new... can you share the domain + pages.dev?
Mumutii
Mumutii12mo ago
Hello, Yes. Page.dev = https://netgen-website.pages.dev/ Domain : https://www.netgen-esports.be/ Any idea @Walshy | Pages ? ;p @Better James here for load script prob
James
James12mo ago
Very interesting, it looks like it's actually failing to find the asset during the next-on-pages routing process. Hmm. Can you build your project locally and send the file located at .vercel/output/static/_worker.js/nop-build-log.json please What's also odd, is the pages.dev one doesn't seem to get a header for the matched path, but the custom domain one does, which makes me rather curious about the why Oh wait lol, I just actually looked at the URL the requests are sent to One's hitting www. and the other is hitting cdn. Is there a reason why your script tags dont specify the https://cdn.domain.com for the custom domain?