Search code examples
regexazureurl-rewritingcdnazure-cdn

Azure URL Rewrite any URL without extension


I'm trying to set up Azure CDN so that any requests that come through without an extension are 'rewrote' to just URL '/'.

E.g. http://example.com/test/ becomes > http://example.com

but http://example.com/static/js/index.js is ignored and passes through unchanged.

How can I do this using Azure CDN management UI?

enter image description here


Solution

  • So I've found that the main pattern to use is [^?.]*(\?.*)?$ as the source Then just index.html as the destination. You have to wait a long time for it to take affect, and I've found that even when it says the rule is 'active' - you may have to still wait another few hours.

    So basically, be very patient until 'active', then wait some more, then it may be active. What a good system... not

    For a full write up of the feature and explanation of what I was trying to achieve, see this article: https://medium.com/@antbutcher89/hosting-a-react-js-app-on-azure-blob-storage-azure-cdn-for-ssl-and-routing-8fdf4a48feeb