0
votes

In Azure when swapping an App Service's deployment slot from staging to live the live site initially retains cached content from the staging slot after the swap. In my case urls which shouldn't be exposed to the public.

At first I continue to see some app-staging.azurewebsites.net urls instead of the the live www.app.com urls which are used for sharing content links.

I believe this is because I cache content and the url variables are being added to the html content that is being cached.

I've tried restarting the deployment slot in order to flush the cache before swapping, but this doesn't help.

The app is .NET Framework v4.7.2 based with the following cache settings in web.config:

<caching>
  <outputCache enableOutputCache="true"/>
  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="Default" duration="600" varyByParam="*"/>
    </outputCacheProfiles>
  </outputCacheSettings>
</caching>

Any ideas how I can prevent this caching issue?

1

1 Answers

0
votes

I've found that the issue goes away if I set the "Always on" to "Off" on the staging deployment slot.

I then restart the staging deployment slot before swapping to production and the problem no longer manifests.

I guess when "Always on" is used Azure must be hitting the default page immediately in order to spin things up, and so trigger any caching that may happen as part of serving up the default page.

Update

This doesn't seem to be 100% effective, I'm still seeing the issue crop up from time to time.