Search code examples
asp.net-mvcazurestagingazure-deploymentazure-deployment-slots

Azure Deployment Slot swap redirects to same domain


My scenario is as follows.

I have my website.azurewebsites.net main site which redirects to https://website.dk (I bought this domain) and created another deployment slot called website-dev.azurewebsites.net. However when I want to visit the 'dev' one it is still being redirected to https://website.dk which has the changes from website.azurewebsites.net.

How can I access website-dev.azurewebsites.net without being redirected to the main one?

Edit: Maybe it is the redirect in the web.config file, but I have commented out the redirect part and published?


Solution

  • Commenting out the redirection is not a good practice as it could cause issues if you swap your dev environment to your production environment and you forget to add the redirection again.

    You should add conditions to your rules so they are only executed in the production environment. I recommend you to follow the steps described in https://gist.github.com/alindgren/999c542a6625ddfb41f1b0293878dcad