IIS Rewrite module – redirect all Http calls to Https – breaks debugging in Visual Studio
Posted by admin on August 23rd, 2011
First you’ll need to install the URL rewrite module. See link for detailed information on URL rewrite.
1 2 3 4 5 6 7 8 9 10 11 12 | <rewrite> <rules> <rule name="Redirect to https" enabled="true"> <match url="(.*)" /> <conditions> <add input="{SERVER_PORT}" pattern="443" negate="true" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" /> </rule> </rules> </rewrite> |
This rule will redirect all Http calls to Https, except calls to Https (otherwise you would end up in an endless loop). Some good info on Url Rewrite Module can be found here.
I you haven’t installed the Url Rewrite Module, your site will crash on the rewrite section.
Another thing we noticed is that debugging in VS2010/2008 with rewrite enabled (enabled =”true”) doesn’t work. Seems to be a bug. More info here and here.
Follow Me!