Hi @Alex Lisitsa ,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
I understand that you would like to know why your Azure FrontDoor is redirecting the backend pool URL.
Per our discussion, I see that,
- AppService also has a domain of coolhost.com.
- And the Azure VM has a domain of myvm.com. (different from AFD)
This issue can be expected from the VM as there is a domain mismatch between the AFD's custom domain and that of VM's.
However, as long as AppService and AFD have the same domain, this issue should not be happening.
Having a different host name at the reverse proxy (in our case, AFD) than the one that's provided to the back-end application server can lead to cookies or redirect URLs that don't work properly. For example, session state can get lost, authentication can fail, or back-end URLs can inadvertently be exposed to end users. This is what is happening in your case.
The recommended solution for this issue is to preserve the original HTTP host name when you use a reverse proxy in front of a web application.
Refer the below docs for more details on this issue:
You wanted to know if we can have the same host name for AppService and AFD,
Keeping the same domain for AppService and AFD is doable.
This would require you to have a custom domain configured in the App Service.
You can refer to Configure a custom domain on Azure Front Door using the Azure portal
Check Under Azure pre-validated domain to get this configured
You wanted to know ,
Is it possible to have the same domain name for the AppService and VM? In this case, I don't need to have the AFD service anymore.
- I am afraid this is not a correct approach.
- While we can have the same domain for both AppService and VM, you will not be able to configure the DNS part of it
- Assume you have created a domain coolhost.com : And you have two Public IPs, one from AppService and one from VM.
- Now, DNS of 'coolhost.com' can only resolve to one IP and thus, this method fails.
Using a same domain for AppService, AzureVM and AFD should be the right approach to fix this.
Additionally, you can consider using App Gateway in place of AFD.
Please let me know if you require more information on this, I shall be glad to address them as always.
Thanks,
Kapil
Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.
Appreciate if you can upvote the same