Incorrect version of website shown

Hi, I am having an issue that I believe is caused by the Headers on my site, but I can’t seem to figure out the issue. When I initially load the site, I am shown an old version. After using clear cache and reload in Chrome the correct version is shown. Then if I reload again it shows the old version again.

The site is https://marketingsuperpowers.com

The correct version has a black menubar at the top. The incorrect version has a blue menubar.

The correct version:

hi there,

first questions:

  • are you sure you are adding the changed files to the repo and pushing them to git?
  • have you checked your deploy history and things are deploying building correctly?

I am seeing some errors in the javascript console when I load that site.

Hi, thanks for the quick reply. I can confirm that my repo looks correct, the items is deploying from Master and I can push changes to it and have them show up correctly on the site - when the correct version is displaying. There are some javascript error, the site is very much a work in progress, but I don’t see any javascript errors that would cause this issue - that I know of.

hmm - i have clicked around a bit, and the only version i am seeing is with a black menu.

how does it look when you access from an incognito window or a different browser?

hmm maybe its just an issue with my computer. Safari shows me the incorrect site, as does Chrome. But Chrome in incognito shows the correct site. Safari on my phone also shows the correct site.

Firefox just shows me a white screen…not sure what’s up with that.

The problem initially started when I was trying to use a webfont and getting a 403 error, I think the error was that the header didn’t have a cross-origin referrer. So I tried some of the things mentioned in this post. I’m not sure if something I did there with changing cache-control could cause an issue. I think I only loaded the site with different headers on the browsers that are having issues.

Hi @Blake32p, I see you have custom cache-control headers set and those are most likely what’s causing the issue. I recommend letting us handle caching for you and see if you have a better experience. You can do this by removing the cache control headers you’re sending your deploy then wiping the cache in your browser for the site. Let us know if that works out for you. Note that you can read more about how we handle caching in the following blog post: https://www.netlify.com/blog/2017/02/23/better-living-through-caching/

I’m not seeing a 403 error when I visit your site, can you tell me how to reproduce that problem? Thanks.

Hi Gerald, thank you for replying to my post. I removed the netlify.toml that had the custom headers. Is that enough to reset the settings so Netlify can handle the cache? Also I added the code back in that has the 403 issue.

Hi, @Blake32p. I also notice that this site is using a service worker:

Service workers act as an intermediary for any HTTP requests for a domain/site. They can, will, and often do override what Netlify will send as a response in many cases. If you are seeing an incorrect version, it can be helpful to double check if that content came from Netlify or from the service worker using the local cache.

That was it! I didn’t realize I had to unregister the service worker. I followed the instructions here on removing the service worker and that solved my issue. Thanks so much!

1 Like