add some examples to explain the Source pattern and Destination ?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.
@Karishma-Tiwari-MSFT thank you 😸
Agreed, I'm completely stuck and can't find any examples of how source pattern works to figure out where I'm going wrong. What I'd like to do is rewrite a CDN URL to remove the first part of the path if it begins with a particular prefix, for example
CDN URL: https://my.cdn-domain.com/etag123456789/path/to/file.html
Origin URL: https://my.origin-domain.com/path/to/file.html
I've set this up as follows but it does not work:
Source pattern: /etag*/
Destination: /
Preserve unmatched path: Yes
Can source pattern not have wildcards? Is the trailing slash the problem? The documentation is really unclear.
@mdgattuso Would you be able to share an update on this. Thanks :)
CC: @TravisCragg-MSFT
I would love more info on URL rewriting as well. We are trying to serve up a SPA (single page app) from the CDN. The SPA is composed of purely static assets, so it seems like an excellent fit. The one caveat is that we need the CDN to serve up /index.html for any request that does not have a file extension (i.e. support client-side "history mode" routing, a common front-end design these days).
So we made a rule that says "If not any
file extension, rewrite the URL to /index.html" We set the source pattern to "/" (as that is supposed to match all) and the Destination to "/index.html". But there appears to be no effect. We even waited 15+ min for the rule to propagate thru the CDN as suggested, and initiated a purge to eliminate any edge caching, waiting 10+ min for that to complete, but there was still no effect from our rule.
An example of how to do this or more documentation on the URL file extension condition and the URL rewrite Action would be very welcome.
I would like to see an example also. Especially which variables are available for the destination.
My goal is to add a file ending to requests without one, to rewrite the path to match files in blob storage.
Also after seeing this. Can we get an update please
FYI: If you are trying to do dynamic rewriting with patterns - it is currently not supported.
But if you have not that many files you can try the cli to generate a rule for each. 😅
It sure looks like it is meant to be supported. How did you find this out?
Had a support call with Microsoft :)
Any updates? I'm trying to use it for a static site that has every page as subfolder with index.html, so I would like to rewrite /page/ or /page to /page/index.html.
I have it working in verizon premium, but I need to create these rules in ARM templates, and so far I'm unable to create verizon rules by ARM, or create working rules for standard CDNs
Setting up a CDN rule to prevent an Angular SPA in Static Websites without it returning a 404 (which is cumbersome for web scrappers such as Facebook, necessary for Facebook sharing features and many more) is more complex than is should. A sample for this somewhat typical request would be more than welcome!
Most helpful comment
Had a support call with Microsoft :)