I created an Azure CDN under Verizon Premium Subscription in the Azure portal with an endpoint which points to my Azure Static Website URL.
I want to create a redirect rule in Azure Verizon engine which adds /index.html
to the end of URL if no extension is specified or the last sing of URL is not a /
symbol.
So far I tried to use (.+\/[^\.]\w+$)
regex expression, you can see an example of how it works here
In this case, if you type the URL https://blah.com/foo/bar in the web browser
it doesn't change the URL however you are able to view some of the content of the existing file from https://blah.com/foo/bar/index.html but some of the links to resources are broken. Not sure why I'm not getting the 404 in this case but maybe its because that I set the Index document name
to index.html
in the Static Website
panel in the Storage account
panel in Azure. If I open the Network
tab in the developer tools of Chrome
I can see a lot of 404 responses e.g.
And its because the website tries to get resources from the
https://blah.com/foo/
directory instead of https://blah.com/foo/bar/
So, for example, the loadcsh.js
in fact is located under the https://blah.com/foo/bar/loadcsh.js
but the website is searching for the file under the wrong directory https://blah.com/foo/loadcsh.js
My second approach
In this case, if you type the URL
https://blah.com/foo/bar
it makes a redirect to https://blah.com/foo/bar/foo/bar/index.html
so the foo/bar/
is redundant here.
My third approach
In this case, if you type the URL
https://blah.com/foo/bar
it makes a redirect to https://blah.com/index.html
I have no idea how to apply the rule which makes a redirect from https://blah.com/foo/bar
to https://blah.com/foo/bar/index.html
and is generic for all such cases.
Any ideas??
Cheers