HTTP to HTTPS redirect on IIS

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$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>











  • 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. 



Comments

Popular posts from this blog

How to prepare your LOB app for Intune?

Information Architecture - Setup your term store to scale

Generate token signing .CER from ADFS Federation Metadata XML