Archive for October 10th, 2020

Redirect Http to Https using Azure CDN

In my recent efforts to move my one page, static content website, I have had a few challenges.  First let me say, those challenges were most certainly due to my ignorance, and not due to the technology in use.  Also, some of my issues are related to trying to make a simple task more complicated than it needs to be (for learning purposes, not for contrariness).

First, it is really easy to setup a static website using an Azure Storage Account.  It really can be done in just a few minutes.  If you don’t care about the URL used to access it, the process can be done in a matter of minutes.

So, to make it take longer, and be more complicated, I first set it to require HTTPS.  Then, I wanted to use my own domain name.  Then I didn’t want to have to put in ‘www’ at the beginning, and lastly, I wanted to be able to get to it without remembering to type https at the beginning of the URL.

There are many tutorials and walk throughs on how to do all of this, so I am just going to point out the thing I didn’t realize until the end.  The CDN endpoint has a ‘Rules Engine’.  You can set some complicated rules, but the one I needed was very simple.  If the request comes in as HTTP, redirect to HTTPS.  Easy, and it worked the first time.  How about that?

image