How to Use Custom Domain with CDN in Azure
Articles on: WebApp
Go to Azure Portal
Go to CDN and in Endpoints
Click to add a Custom Domain and fill in the Custom Domain which is Hosted on GoDaddy etc.![](https://storage.crisp.chat/users/helpdesk/website/8ac493e7b0ef2800/8d2d86d6-43af-4acb-aa5f-eca118_mpojob.png)
Now to avoid the Looping on website, After creating the CDN profile and endpoint, open it and go to Caching rules. Copy the following setup (highlighted the important bits, feel free to set the "cache expiration duration" to anything which fits you")
Global caching rules - query string caching behavior - Cache every unique URL
Custom caching Rules - Match Condition: Path - Match Value: /wp-admin/ - Caching behavior: Bypass cache
Map your custom domain to your Azure CDN by adding the endpoint in CNAME WWW record
For Naked Custom Domain , You need to double check if your TXT and A records on your DNS registrar using the configurations described
A record to point to the IP address of your WebApp
TXT record with host @ and value WebApp Url
The next step is map the requests to the CDN Custom Domain URL inside of your code by using Redirect Rules in .**htaccess file**..
Updated on: 31/01/2023
Go to Azure Portal
Go to CDN and in Endpoints
Click to add a Custom Domain and fill in the Custom Domain which is Hosted on GoDaddy etc.![](https://storage.crisp.chat/users/helpdesk/website/8ac493e7b0ef2800/8d2d86d6-43af-4acb-aa5f-eca118_mpojob.png)
Now to avoid the Looping on website, After creating the CDN profile and endpoint, open it and go to Caching rules. Copy the following setup (highlighted the important bits, feel free to set the "cache expiration duration" to anything which fits you")
Global caching rules - query string caching behavior - Cache every unique URL
Custom caching Rules - Match Condition: Path - Match Value: /wp-admin/ - Caching behavior: Bypass cache
Map your custom domain to your Azure CDN by adding the endpoint in CNAME WWW record
For Naked Custom Domain , You need to double check if your TXT and A records on your DNS registrar using the configurations described
A record to point to the IP address of your WebApp
TXT record with host @ and value WebApp Url
The next step is map the requests to the CDN Custom Domain URL inside of your code by using Redirect Rules in .**htaccess file**..
Updated on: 31/01/2023
Updated on: 01/07/2024
Thank you!