Hello @Anonymous ,
I understand that you are getting error 404 when accessing your Azure Front Door default or custom domain URL.
From your screenshots, I can say that the root cause of your issue is the empty origin host header.
Let us first understand what origin host header does. Requests that are forwarded by Azure Front Door to an origin will include a host header field that the origin uses to retrieve the targeted resource.
For example, a request made for www.contoso.com
will have the host header www.contoso.com
. If the request was made for www.contoso.com
, and your origin contoso-westus.azurewebsites.net
has an empty header field, Front Door will set the host header as www.contoso.com
.
Most app backends (Azure Web Apps, Blob storage, and Cloud Services) require the host header to match the domain of the backend. However, the frontend host that routes to your origin will use a different hostname such as www.contoso.net
.
If your origin requires the host header to match the origin hostname, make sure that the origin host header includes the hostname of the origin.
You are using Azure App service as your backend, and you also mentioned that there is no custom domain configured on your App service. Now, if the origin host header is kept empty, the AFD will forward the request including a host header as your custom domain, but it is not configured on your App service and hence it will not match with your App service domain and eventually fail with 404 not found error. Because the App Service doesn't recognize the custom domain and rejects all incoming requests for this host name. It can't determine where to route the request.
The point that you mentioned "I didn't set a host header because I want to stay on my custom domain" only applies when you've the custom domain configured on your App service as well.
If you don't configure the custom domain in your backend and just keep the Azure Front Door origin host header empty, it just overrides the host name, which can lead to various issues as described in the below section:
The proper guidance here is to make sure you configure both the backend and AFD to preserve the host name. And to do so, you need to configure the custom domain in your App service and then keep the Azure Front Door origin host header empty. This way, when the AFD sends the request with the custom domain, the App service will be able to recognize the incoming request with the host name and will accept it without any issues.
To fix this issue, you can either add the origin host header as your App service URL.
OR
Configure the custom domain in your App service and keep the rest of configuration as it is.
Kindly let us know if the above helps or you need further assistance on this issue.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.