Search code examples
iisweb-configazure-web-app-serviceazure-deployment-slots

Azure app service slot settings - using them in web.config


We'd like to slightly alter our web.config file in different slots. For example, we'd like to redirect and proxy to different urls in different slots. I was thinking about using app settings, which can be read as env variables, but I couldn't find a way to use them in the XML. I image something like this:

<rule name="Reverse proxy" stopProcessing="true">
  <match url=".*" />
  <action type="Rewrite" url="{ENV_EXTERNAL_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>

That {ENV_EXTERNAL_HOST} part is of course wrong. Is it possible to use these settings from the contents of the web.config XML file?


Solution

  • We ended up using rewrite maps to map incoming urls to different values.