Search code examples
azureazure-cdn

Forcing HTTPS with Azure CDN


I’m using Azure CDN in front of a Storage Account. I’m wanting to serve everything via HTTPS only, so I’ve setup HTTPS on the custom domain and created a URL rewrite:

HTTPS rewrite rule

But the problem is that I end up at a URL like this: https://the-custom-domain/website/17/index.html

The website/17/index.html is the root content within the Storage Account, but I don’t know why it’s appending the container path before the filename. There’s also rewrite rule for static files (https://blog.lifeishao.com/2017/05/24/serving-your-static-sites-with-azure-blob-and-cdn).

Any idea what’s wrong with the URL rewrite?


Solution

  • I am using Azure Verizon Premium CDN.

    I did two rules. The order of the rules matter. You will need to wait up to 4 hours after each test.

    image remove index.html 2 continue as image 3

    enter image description here

    enter image description here

    =============== END FIRST RULE ==================
    enter image description here

    enter image description here

    here as text
    1. redirect HTTP to HTTPs
    rule--> (.*) destination https://%{host}/$1

    1. remove remove index.html did not work 100% ;-(
      URL Rewrite
      2.A Source ((?:[^\?]/)?)($|\?.) -Destination -> $1index.html$2
      2.B Source ((?:[^\?]/)?[^\?/.]+)($|\?.) -Destination - > $1/index.html$2