Scenario:
Configured Azure Application Gateway to route traffic to different Azure Web Apps to leverage the Web Application Firewall (WAF).
Initial configuration worked fine except that the final URL in the browser is the {mysite}.azurewebsites.net. I want this to be the custom domain name {subdomain}.{mysite}.com. This was configured by having the backend pool bound to an app service. Changing it to FQDN is not working. Screen shots below.
CNAME is already pointing to the gateway.
Desired result
When someone hits {subdomain}.{mysite}.com (which is already configured to point to the gateway) I should get {subdomain}.{mysite}.com not {mysite}.azurewebsites.net
Current setup:
The gateway is configured with a multi-site listener with its rule pointing to a backend pool and also bound to the http setting.
Listener is listening on {subdomain}.{mysite}.com
The following links provide some partial answers/configurations but none of them worked for me. Application Gateway - 502 error
https://learn.microsoft.com/en-us/azure/application-gateway/create-web-app
UPDATE
Here are a list of steps used to configure an azure app service with a custom domain behind the Azure Application Gateway and WAF (Web Application Firewall) using the azure portal UI.
- Configure a Backend pool with target pointing to your App Service.
Configure Health Probe with the following settings
- Protocol: HTTP or HTTPS
- Host: {appservice}.azurewebsites.net
- Path: /
Configure Http setting
- Use App Service unchecked.
- Use custom probe checked.
- Pick host name from backend address unchecked (you might have to check this to configure the rule and then uncheck it).
Configure listener
- HostName: {subdomain}.{domain}.com (your domain)
Configure basic rule
- Bind it to the appropriate http setting, backend pool and listener
- Caveat: If there are no http settings with Pick host name from backend checked, you might need to change it, attach it, and then remove that flag again.