Functions issue: old files served from custom domain, pages.dev URLs ok

Functions issue: old files are being served from custom domain, new files are served from pages.dev URLs

I’ve confirmed this by trying it on different devices to ensure it’s not a browser caching thing.

Screenshot 2024-05-06 6.06.45 PM

If I use the X.pages.dev domains you see there, the latest release is there.

If I use my custom domain, it is serving up old files. I’ve tried “Retry deployment”, I’ve tried pushing new code, neither works. And as I said above, I’ve tried different devices, and same thing happens.

Do you have any cache configuration on your zone configuration for the custom domain?

It’s generally recommended to disable this and rely on the Pages cache directly, or old assets could be served. See the following for more info:

I don’t have any caching setup on my domain (not that I explicitly did anyways?).

But turns out it fixed itself after a while, looks like it’s serving the new files now.

Zones with Cloudflare have a default browser and edge cache TTL that is generally recommended to disable with Pages.

I believe the default edge cache TTL is something like 2 hours, but can cause issues like you’ve described after rolling out changes to your site. This is especially true if your assets and things don’t have unique filenames (with hashes or similar in the file-names), like is common with most modern web frameworks.

2 Likes

That would probably be it, but I hadn’t noticed that happening before until yesterday. Usually the fixes go out immediately.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.