Netlify CMS showing old config unless in incognito window

Hi!

Our content writers keep seeing an old version of the CMS, despite several new builds being uploaded with significant changes to config.yml.

The only way to get the new config to appear is to CTRL+SHIFT refresh (logging in again after that still shows the old version) or log in using an incognito window. This is less than ideal.

I’ve tried adding no-cache html headers to the admin html page but the problem still persists.

Is there a way to force Netlify to send no-cache headers whenever somebody accesses /admin/index.html ?

If it makes any difference, our site is a static export from Svelte + Sapper.

Hey @jdd,

What site is this about?

I can’t post a link to our staging site publicly, unfortunately.

We’re using the setup exactly as described here, via a static export from Svelte/Sapper:

At what point is config.yml loaded/parsed by netlify-cms.js?
Could a good old fashioned cache-buster query be added to prevent a cached versions of the config being loaded?

Returning to the site today, it’s still showing a >2 week old version of the config unless you hard refresh or use an incognito window. I’ve seen a few other threads about this issue.

Any ideas?

Do you have any caching headers in place that might be too aggressive?

Thanks for getting back, @tomrutgers and @hrishikesh

Nope, no custom headers in our netlify.toml, all standard stuff.

Could it hurt to add a random/timestamp query to the end of the fetch URL for config.yml in the Netlify CMS runtime to avoid this scenario?

Hey @jdd,

You could add that, but it would probably be better to fix the underlying cause. But I understand you can’t share your site and thus, we cannot check for the issue.

However, the CMS might not change the suggestion you describe anytime soon, but I believe you can use a custom path for the config.yml file. In that case, you could generate a random file name for each deploy and link the CMS to that.

1 Like

Thanks for your reply @hrishikesh your suggestion worked… eventually.

First I tried the custom config path, but with a random query string added to the config.yml url — in this case, Netlify flat out refused to return the file with any sort of query on it. So we’ve resorted to renaming the config file and updating its name in our admin/index.html for every update. Yes, we could write an npm script to automate this on every build, but this is gaffer tape development territory, not ideal.

Is there really no way to control how Netlify handles caching? I can’t see any options for it anywhere, am I being dumb?

Hey @jdd,

Netlify’s caching is working fine for a lot of deployed sites right now (and probably also causing issues for a few), but if you give this a read: Better Living Through Caching, you can understand how caching works here.

I’m not seeing a problem that you describe in the mentioned approach, so I believe there’s something else that’s happening.

Also, I don’t see how adding query parameters would stop the file from loading, so this is all getting into a big mystery for me.