1
votes

I'm trying to figure out what is causing an override of an environment variable defined in the Azure Portal configuration of an App Service, but just can't find it.

The Portal holds a number of configuration settings, this specific one is named CorsAllowedOrigins. This setting is also defined in the web.config file.

As I understand it, the App Service runtime will override any web.config app setting with what ever is in the App Service Portal configuration. And it does, sort of.

Checking all environment variables in Kudu, I can see:

  • APPSETTING_CorsAllowedOrigins = [Portal config value]
  • CorsAllowedOrigins = [web.config appSetting value]
  • AND WEBSITE_CorsAllowedOrigins = [Some value I've never seen before]

When printing the value of it using ConfigurationManager.AppSettings["CorsAllowedOrigins"], I get the WEBSITE_CorsAllowedOrigins value. What is it that actually sets values prefixed with WEBSITE_? It seems reserved for system values, and that is the only value that seems to be duplicated in that way. Also, this is only in a specific App Service slot (naturally the production one...) and only in that App Service. Almost seems like a bug, no?

1

1 Answers

1
votes

Ok, so Azure App Services also has a CORS setting pane in the Portal, which will override anything you have in code and this is why my setting didn't apply.

The setting value was confusingly like the custom value I had added, so I didn't realise it wasn't the same setting.