HTTP to HTTPS redirect on IIS

July 17, 2015

The requirement was simple. To redirect all HTTP traffic to HTTPS traffic. First thought that crossed my mind is - "Can't we do it with HTTP redirect?". After trying the approach, the site went into a infinite redirect loop. Pretty obvious! Right? After some googling, this is what I have done. 

<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />

  • Recycle Website
This gave me a great start on URL rewriting. Post this, I setup a proxy and written multiple rewrite rules on IIS. The below article by Jim van de Erve is very helpful. 

You Might Also Like


Popular Posts