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

Updating SourceData/ Data Source of the Pivot Table

Salesforce.com migration tool - Deploying Weblink and migrating files with special characters

Information Architecture - Setup your term store to scale