About caching gatsby pages

Hi, I have a lot of gatsby sites on netlify and I have a big problem with one of them w3vitals.com. When I uploaded some changes in page URLs some of my clients cached those changes and now that the URLs are changed again they stuck with the old ones. So when a specific user of mine go to the services page he is visiting 404, he cleared his cache and all local data and tries it again but the problem persists. When he is in the broken URL if he hard refreshes he gets the page but when he navigates to it he is going to 404. Another strange thing is that in the incognito mode he can navigate without having any problem. Any help is appreciated!

Hi there, @rnd :wave:

Welcome to the Netlify Community! This is a great question, thanks for posting it. There are two different places you can look at to get started.

First, this may be caused by having a service worker on your website. You can read about service workers and how to unregister them on this post. The second thing to investigate would be browser extensions that this user has, as those could interfere with normal page functioning.

Let us know if this is helpful!

Service workers, indeed. @rnd you’re using gatsby-plugin-offline and unless you’re exhibiting very careful and finite control of your caching patterns and structures, you may run into a number of caching-based headaches.

Given the way SW caching works for clients, removing the service worker isn’t quite as simple as just removing the plugin. You’ll want to replace gatsby-plugin-offline with gatsby-plugin-remove-serviceworker and publish your site with that plugin for quite a while. Basically as long as you think it takes for everyone who had visited your site prior to visit it again. After that time has passed, you can remove the the remove-serviceworker plugin and carry on without it.

Hope that helps!


1 Like

Hey Jon, I am familiar with how service workers work and in fact that is the first thing I tried. My client did as I instruct and clear my service worker and refresh the page to get the new one. Isn’t gatsby-plugin-offline service worker updating its version every time you publish new content?

Hi Hillary, thanks for your response. I have tested both the service workers and the chrome extensions and I can confirm that the problem lies elsewhere. I haven’t found this problem in any of my other projects and I use the same stuck and provider. That’s why I thought that it can be a cache layer on the provider side. Do you got anything else to suggest?

@jonsully sorry I didn’t tag the above answer I am new here

@hillary sorry I didn’t tag the above answer I am new here

Hello @rnd ,

Thank you for following up! I am going to take your question to our team to see if I can get some additional insights here. Either myself or a member of my team will follow up again on this thread.

Hello there, @rnd :wave:

Thank you for your patience! I have a few more steps for you to try with the client you are working with.

First, please encourage your client to clear their cache again. Additionally, please ask them to try the same action from a different wifi network to confirm is they encounter the same situation or not.

Second, please ask your client to get their x-nf-request-id. Here is a resource from our Support Guides on how they can do this! We will use this to check our data logging system and find some specifics about this request.

Lastly, would it be possible for you to share a screenshot of what the client is experiencing and a screenshot of what expected experience should be? Comparing these two images will give us further information about the situation.

Thank you!