How can I clear a client's cache?


#1

I have a website made with create-react-app. It’s problematic because when I push changes, the client can’t get it as the website is loaded up from a service worker(cached) -> Loads the rest from the disk cache. My terrible code prevents access to the service-worker after loading up the site the first time. Basically, the entire site is loaded from the cache; though there is a single request made to my server. Is there any way that I can use Cloudflare to intercept that request and instruct the client to clear the client’s entire cache?


#2

You cant clear the cache, but you can set appropriate caching headers when you serve the code.


#3

The recommended method to make sure browser cache is effective and users always have the most recent files is via cache busting