1

I am running an ASP.NET MVC application on Azure App Service with a Front door.

The front door is setup with a custom domain and points to myapp.azurewebsites.net as backend.

Going to mysite.mydomain.com shows the expected page, but the host records myapp.azurewebsites.net as the request url instead of mysite.mydomain.com.

This issue affects Google external login which uses PathString to set my returnurl to myapp.azurewebsites.net/signin-google and my logging which uses Request.Url to login the requested page.

1 Answer 1

0

The configuration of a backend in a Front Door backend pool includes a Backend host header field, which determines the host name used for forwarded requests. By default, this is set to the backend host name, meaning all requests forwarded to this backend will appear to the backend by its own host name. You can either change the value of this field to another host name (e.g. mysite.mydomain.com in your example), or leave it blank to always make it use the request host name.

Check out the documentation on this topic here.

As noted in the comments, your backend will need to be able to accept requests under the custom host name. In the case of an Azure Web Application, this means also adding the custom host name to the Web App.

5
  • Changing Backend host header to mysite.mydomain.com or blank results in website not found for mysite.mydomain.com. Linked documentation also states: Most app backends (Azure Web Apps, Blob storage, and Cloud Services) require the host header to match the domain of the backend.
    – stefan
    Jul 9, 2021 at 6:56
  • @stefan The Front Door only changes the host name that appears in the request. You will still need to take all the usual steps necessary to make your web app accessible under a particular host name (for example, adding a custom domain to your web app). Basically, if it would be accessible under your custom host name without the Front Door, then making the Front Door change the host header to your custom domain should not cause a problem. I currently have this setup running for two web apps and it's working fine, although of course your situation could still be different.
    – Vera
    Jul 9, 2021 at 15:32
  • I added mysite.mydomain.com as a custom domain to my App service and now it is working. Is adding a certificate to this custom domain necessary for a secure connection between the front door and my App service?
    – stefan
    Aug 4, 2021 at 12:30
  • @stefan I'm not actually sure, but I think the Front Door will connect to the Web App by what's specified in the Backend host name field, which in the case of a *.azurewebsites.net host name is already secure, regardless of whether your custom host name would be secure. Even so, assuming you already have the certificate to secure your Front Door, adding the certificate to your Web App might not be that much trouble and may be worth it 'just in case'.
    – Vera
    Aug 5, 2021 at 12:32
  • I updated my answer with a note about adding the custom host name to the Web App.
    – Vera
    Aug 5, 2021 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.