Looking at setting up an Azure CDN on our site and have looked at this article: Add Azure CDN (or any CDN) to your Episerver site (getadigital.com). The article describes this as rather straight forward but before I try this I have some questions about the setup.
When using this kind of setup with CDN (apart from services like Cloudflare), the CDN needs to pull the source from the origin site to be able to serve it. But how is it, with the rewrites that the article suggests, that it can still pull the file from the source? Doesn't the rewrite rule makes it so when the Azure CDN tries to pull the source it gets a rewritten url to the file pointing to the CDN and therefor is unable to pull the file? Am I missing something in the rewrite rules and this will work as expected? A bit cautious to try it out in production before making sure it will work as expected.
If you look at the match conditions of the rewrite rules, you will notice that they apply only to the regular URLs. They then rewrite to a specific subdomain (which is not part of the match condition). So in that example there are no "circular rewriting" (sounds like that is your main concern).
Remember you can also use Azure CDN as a reverse proxy (like Cloudflare, although with fewer features), so you don't need to rewrite URLs to another domain.
Of course, thay are applied to the specific rendering tags, not the file itself. Thanks for the insight!