I created a basic Azure app service with php-8 (call it myapp) with app service plan B2. I also created one application gateway with tier WAF_v2. I set the listner port to 80 and backend http setting protocol to http. In the backend pool there is only one target which is myapp.
I opened the link "myapp.azurewebsites.net" through browser and it opened successfully with https protocol. But when I opened it through the ip address of application gateway, I got the error as shown below -
Here I could see the url has a port 80 which is of http. I checked the backend health status of my application gateway and it is healthy.
Here is the snapshot of my backend http setting -
I also tried with making the change in configuration of myapp by disabling the Https Only so that no redirection happen when request comes at https. But still the same error is coming on browser.
I tried to reproduce the same in my environment and got the results like below:
I created App service with php-8 plan B2 like below:
I created an application gateway with WAF v2 like below:
Added backend setting:
Make sure the backend health status is healthy like below:
In your virtual network -> service endpoint check whether Microsoft.web
like below
In app service -> under Networking -> Access restriction
Try to allow access from virtual network to access the network like below:
when I try to hit my public IP, it redirects successfully like below:
Reference:
Connecting an Azure Application Gateway to App Services by davidgiard
Manage traffic to App Service - Azure Application Gateway | Microsoft Learn