Azure CDN and the origin host info "www.mydomain.com" instead "myapp.azurewebsites.net"

Jonatas Luis Albers 1 Reputation point
2020-06-15T15:45:06.26+00:00

Dear colleagues and CDN specialists,

I'm new in CDN settings, and I'm having some problems.

I set up an Azure CDN (Microsoft), pointing to my domain www.<mydomain>.com for <app-name>.azurewebsites.net (web application)

Visually it looks like and everything is working fine, but in some parts bring my <app-name>.azurewebsites.net, and not www.<mydomain>.com.

For example, when I use @Request.Url in my code web application, it doesn't bring "www.<mydomain>.com", but brings "<app-name>.azurewebsites.net"

Also, analysing the header with Dev Chrome Tool, "set-cookies" brings the domain "<app-name>.azurewebsites.net", and not "www.<mydomain>.com"

In the image below how it is configured now: 10006-cdn.png

I tried to change the "Origin Host Header" to www.<mydomain>.com, however the changing returns an error that my web application does not have the custom domain www configured in web application. 10081-cdn-error.png

However, how can I configure the custom domain in my origin if in DNS my CNAME www is configure to the CDN endpoint?

Would anyone know to help me what is the correct way of configuration so that the header and @Request.Url brings only the information from the www and not the origin web application?

Kind regards

Jonatas

Azure Content Delivery Network
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. TravisCragg-MSFT 5,681 Reputation points Microsoft Employee
    2020-07-25T00:58:15.6+00:00

    This is a common issue when using Azure App Services, and the best solution is to modify the location header to have the correct URL. This concept is discussed further Here in the Application Gateway documentation.

    Because you are using Azure CDN and not Application Gateway, the process of modifying the header will be different.

    0 comments No comments