Application gateway - Result in HTTP Error Code 404 while invoking backend service.

Divity, Ranjeet 1 Reputation point
2021-01-21T07:31:20.857+00:00

Scenario - We have created Application gateway with following configuration for our web application, but still not able to access backend service. Fontend web app fails to make call to back end service via application gateway.

  1. Frontend public IP Adress 20.72.XXX.XXX
  2. Gateway WAF V2 tier
  3. Virtual network/subnet 172.20.0.0/26
  4. Backend pool with FQDN address of our App service hosted on Azure 5.We have created 3 backend pools
    1. Mobile web App storage FQDN
    2. Desktop web app storage FQDN
    3. Back end App service EQDN
  5. Basic Listeners for port 80/443 that is Associated Rule (HTTPS_PathRoute which is path based route role) mentioned below7
  6. Rule - path based that route the traffic to respective pool based on the context root. following the context root rule /m/* routes to mobile web app storage account /d/* routes to desktop web app storage account /api/* routes to back end app service 8 Health check probe for both back end App Service and frontend (web/desktop) application.

Technology - Frontend Desktop app & Mobile App are hosted in Storage Container.
Back end service is hosted in Azure App Service.

Result - Back end service call fails with HTTP Error Code 404

Regards,

Ranjeet Divity

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
962 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Harshvardhan Saini 36 Reputation points
    2022-04-09T02:47:08.447+00:00

    If you are doing it for the first time then I believe your backend api endpoint does not starts the word '/api'.

    The thing is when you access frontend IP with a path based routing rule like '/frontend-ip/api/get-data' it simply replaces the frontend-ip with the backend ip and keep other part of URL as it is so the request sent to backend would be
    '/backend-ip/api/get-data'

    Whereas actually your backend contains the API URL like '/backend-ip/get-data'

    There are 2 ways to solve this issue

    1 > Edit the httpsetting of the rule and add a '/' in the "override backend path"

    191511-appgateway.png

    2> Drive the path based rule in such a way that the final path (like /api/ in your case) should actually exists in the backend server or webapp.

    1 person found this answer helpful.