Reputation: 3068
I've created an Azure Static Website which works based on the Azure Blob Storage. To be able to manage the automatic redirect from HTTP to HTTPs I created Azure CDN with Azure Verizon Premium subscription and I created an endpoint which points to the URL of the static website. I followed the steps from this tutorial
If you hit the URL e.g.
https://blah.com/foo/
You will be automatically redirected to
https://blah.com/foo/index.html
This is because I set the Index document name to index.html
in the Static website configuration panel.
What I want to achieve is to add the /index.html symbol to the very end of URL if it doesn't have an extension e.g.
https://blah.com/foo
https://blah.com/bar/foo
The expected result would be a redirect to:
https://blah.com/foo/index.html
https://blah.com/bar/foo/index.html
So my idea was to open the https://cdn.windowsazure.com/http/rules/default.aspx and try to create a new Rule; feature
-> URL Redirect
. In the TextBox near the Source
label, I tried to specify the condition using Regex expression ^[^.]+$
which checks if the path contains a .
If yes then it would mean the URL points to file with extension and the /index.html
should be added to the end of URL. I think my Regex expression is wrong and should be different. Or maybe it is not the best way to achieve what I want?
Any ideas?
Cheers
Upvotes: 1
Views: 1326
Reputation: 96
Just further to this as I know it has an accepted answer but you won't need any redirect rule for index.html if you use a custom origin and use the static website's primary endpoint (will be something like .z8.web.core.windows.net/). For whatever reason, the CDN will treat that as a web server rather than a vanilla storage place.
Upvotes: 0
Reputation: 3068
So I tried almost everything and in the end, after adding this rule the Azure Static Webiste worked as expected:
Upvotes: 1