1
votes

I have an Azure website (not web role) with 2 slots: Production and Staging.
I want to enable cdn only for production slot, and not for staging, thing is I couldn't find a way to identify the host slot.

RoleEnvironment Isn't available since Azure websites don't have it.
I tried to configure in the portal at the app settings section, but swap action swaps the configuration with the slot.

Do you have any other suggestion to know if the websites runs in production or staging ?

Thanks

1

1 Answers

1
votes

One of the original design goals for the site slots feature is zero downtime while swapping the slots. To get a zero downtime it was decided that the website host process shouldn't restart because of a swap operation, and therefore the app settings get swapped with the site.

For now you have 2 possible ways to work around that

1) If that's a decision that you can make on a per request basis, you can look at the HOST header that's coming to your site as they differ.

2) The other option is to use manually or using Azure APIs or the command line tool update that app setting yourself before swapping.