Solved

Redirect HTTP to HTTPS in Azure (With Load Balancer)

Posted on 2016-10-11
2
30 Views
Last Modified: 2016-10-14
We have 2 Web servers in Azure that are Load balanced.
We just installed SSL in our these azure websites to convert it to HTTPS.

Now we want that any request coming in as HTTP should be changed/redirected to HTTPS connection.

So, I for testing I created a published website on my local machine, then added self signed
SSL certificate to get a secure site. Then I used URL rewrite to direct my HTTP site to HTTPS.
I used this in Web.config.

This works perfectly on my local published site.

But this fails on the Azure server and gives me an Internal Server Error.

Any ideas?

I used the following in Web.config for the URL rewrite


	<rewrite>
		<rules>		
			<rule name="HTTP to HTTPS redirect" stopProcessing="true">
				<match url="(.*)" />
					<conditions>
                        <add input="{HTTPS}" pattern="Off" />
						<add input="{REQUEST_METHOD}" pattern="^get$|^head$" />
					</conditions>
					<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="SeeOther" />
			</rule>			
		</rules>
	</rewrite>

Open in new window

0
Comment
Question by:SHANCHAT972
2 Comments
 
LVL 26

Accepted Solution

by:
Dan McFadden earned 500 total points
ID: 41841961
Microsoft article on how to setup SSL offload.

Link:  https://azure.microsoft.com/en-gb/documentation/articles/application-gateway-ssl-arm/

Dan
0
 

Assisted Solution

by:SHANCHAT972
SHANCHAT972 earned 0 total points
ID: 41843942
Your solution did not work.

But I figured it out. I was missing the URL rewrite module on IIS on the server. Installing that did the trick

https://www.iis.net/downloads/microsoft/url-rewrite


Now the IIS server can redirect the url requests from HTTP to HTTPS :-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now