Search code examples
azure-application-gatewayazure-appservice

Not able to open app service from public ip address of application gateway


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 - enter image description here

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 - enter image description here

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.enter image description here


Solution

  • 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:

    enter image description here

    I created an application gateway with WAF v2 like below:

    enter image description here

    Added backend setting:

    enter image description here

    Make sure the backend health status is healthy like below:

    enter image description here

    In your virtual network -> service endpoint check whether Microsoft.web like below

    enter image description here

    In app service -> under Networking -> Access restriction

    enter image description here

    Try to allow access from virtual network to access the network like below:

    enter image description here

    when I try to hit my public IP, it redirects successfully like below:

    enter image description here

    Reference:

    Connecting an Azure Application Gateway to App Services by davidgiard

    Manage traffic to App Service - Azure Application Gateway | Microsoft Learn