Solved

Redirect HTTP to HTTPS in Azure (With Load Balancer)

Posted on 2016-10-11
2
84 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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