Azure static web app - old cached version still shows

StoicalPirate 21 Reputation points
2022-04-21T00:48:54.897+00:00

When I navigate to my Azure static web app using Chrome I'm suddenly seeing an old version from months ago. It seems that several others have had this issue over the years, but I couldn't find any definitive solution anywhere. Disabling cache in 'Developer Tools' on Chrome then right-clicking on the refresh button and selecting 'Empty cache and hard reload' lets me see the latest (correct) version of the site ... but once I navigate away and return I get the old version again. When I navigate to my static web app in Chrome incognito mode, or on my phone, or in another non-Chrome browser I get the latest (correct) version. This issue happens whether I visit my custom domain or directly to the azurestaticapps.net address. How can I fix this?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
843 questions
{count} votes

Accepted answer
  1. brtrach-MSFT 15,791 Reputation points Microsoft Employee
    2022-04-27T04:26:25.197+00:00

    @StoicalPirate Thank you for your question regarding browser cache.

    Please note that this is technically out of scope of Azure Static Web Apps as this appears to be either an issue with your browser or your site's code that is causing it to remain in cache. This response is being provided as a best effort so please be understanding and let us know if you have questions.

    There are two items that come to mind.

    1. The fact that this issue appears to only have happened on a single browser (did not happen on your phone or in incognito mode) could point to corrupted browser cache, which was resolved when you did a full clear of the cache. This is most likely the issue since you did not observe the behavior on any other device/browser.
    2. While I would say the above is likely the issue, you could also try playing around with the cache-control header. Setting Cache-Control: no-store would force the client browser to not cache any site resources. This has two negatives though in that it will cause higher resource consumption on your static web app and clients will see slower performance on your site. I really would only advise going down this path if you observe the behavior on other browsers as well.

    Let us know if you have further questions or concerns.


0 additional answers

Sort by: Most helpful