azureazure-application-gateway

Azure Web Apps Default Document not working on Application Gateway


I created an azure web app. If you browse the web app, you get the default document page. The default page for the app is index.html.

I created a Application Gateway. In the demos I found, they did not enter a Path Based Rule. When they put the gateway IP address in the URL bar, it opened the site.

I am required to enter a path. I used /* as my path. I assumed that would be the root of the web app.

enter image description here

If I enter the app gateway IP in the URL bar, I get a 403. If I manually put [ipaddress]/index.html it opens the site.

How do I define the rule so that I don't have to put the default document in the URL manually?

Here is the setting on the web app: enter image description here


Solution

  • AFAIK, some static sites or frameworks (like Angular or React without proper rewrites) won’t automatically map / to /index.html. You can test this by

    For testing, try accessing the app URL manually and check whether it redirects to index.html or not.

    `http://<your-app>.azurewebsites.net/`
    

    If that returns a 403, it's not an Application Gateway issue — it's because the app isn't serving a default page at /.

    "I created the same resource in my lab and tested it using the Application Gateway IP, and it successfully loaded the default index.html as shown below.

    http://130.107.130.131/

    enter image description here

    Even when I try to access it with index.html, it redirects to the same page as shown below.

    http://130.107.130.131/index.html

    enter image description here

    App url: https://sampath-a0b9gaaqhndgadcm.canadacentral-01.azurewebsites.net/

    enter image description here

    Below are the backend settings configured for my application gateway. enter image description here

    Rule settings

    enter image description here