Reputation: 25099
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:
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?
Upvotes: 19
Views: 11298
Reputation: 1366
If you want simple 1:1 http to https solution (without any unwanted) you should use following rule:
https://%{host}/%{request_uri#/}
IF
Feature
301
(.*)
https://%{host}/%{request_uri#/}
Upvotes: 0
Reputation: 5612
No need to enter anything to the hostname, path etc..
Make sure that you have turned on both HTTP and HTTPS in the Origin Settings
It should reflect within 10minutes
Upvotes: 5
Reputation: 2611
There is an official guide from MS here, which works with standard Azure CDN:
https://learn.microsoft.com/en-us/azure/cdn/cdn-standard-rules-engine
Summary below:
Redirect users to HTTPS
Upvotes: 18
Reputation: 1648
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
=============== END FIRST RULE ==================
here as text
1. redirect HTTP to HTTPs
rule--> (.*) destination https://%{host}/$1
Upvotes: 11
Reputation: 21
I am using below configuration for redirecting any request to https
IF
Feature
https://%{host}/$1
Upvotes: 2
Reputation: 61
I'm using Azure Verizon Premium.
In this case you might want to redirect your http requests to your https endpoint. In this case you must add one rule for each endpoint you want this behavior:
match condition:
if Request Scheme = HTTP
feature:
Redirect - Code: 301, source: (.*), destination: https://%{host}/$1
This response was found at docs microsoft
Upvotes: 6