Host without subdomain variable in Azure CDN Rules

Category: azure cdn

Question

Dean-Armada on Wed, 18 Apr 2018 12:28:35


First of all, I can't seem to find anywhere the available variables to be used for Azure CDN Rules. I'm aware that there is %{host} variable to return the value of the domain used to access the CDN. But it includes subdomains like "www". Is there an available variable to be used to remove those subdomains? What I'm trying to achieve is to ReWrite dynamic html files. So my destination value right now is "$1%{host}.html$2". So if www.example.com is my custom domain then it will be "www.example.com.html". But I want it to render "example.com.html" even if www.example.com is accessed.

Replies

Richard Li - MSFT on Thu, 26 Apr 2018 01:44:43


You can try this: %{host#www.}
We will add this to our documentation asap.

Richard Li - MSFT on Thu, 26 Apr 2018 01:45:07


The # is a delimiter that means delete the matching string that comes after this.