How to fix the path based routing in application gateway

George Mathews 0 Reputation points
2025-04-18T14:10:56.9166667+00:00

Hi Q/A Team,

I have configured two ubuntu servers and added embed code in the html one is image embed code and other one is youtube embed code so i have created application gateway loadbalancer for path based routing so I have configured all the backend pools, routing rules and health probes as well and both backend health status are healthy so the challenging thing is when i try to browse with loadbalancer ip with the path I'm getting error that 404 not found. how to overcome this issue.

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

2 answers

Sort by: Most helpful
  1. Venkat V 1,485 Reputation points Microsoft External Staff
    2025-04-23T07:03:32.35+00:00

    Hi @George Mathews,

    Please verify that the path patterns in your Application Gateway routing rules match the actual content served by your backend servers. For example, if the rule is /images/*, your server should serve content like /images/index.html.

    Additionally, log in to both Ubuntu VMs and check whether the corresponding folders exist using the appropriate commands.

    sudo ls /var/www/html/images/
    sudo ls /var/www/html/youtube/
    

    User's image For testing, try accessing the application directly from the backend VM's public IP and check whether you're able to reach the content successfully

    http://<backend-ip>/images/
    http://<backend-ip>/youtube/
    

    Check the local firewall ports using the cmdlet below.

    sudo ufw status verbose
    

    If the firewall is enabled, make sure to allow port 80 using the cmdlet below

    sudo ufw allow 80
    

    To enable UFW (if needed): sudo ufw enable

    If you are able to access the application using the VM's public IP, please verify the path-based settings in the application gateway's backend target configuration.

    User's image

    And also check the backend settings configuration.

    User's image

    **Health Probe settings
    **
    User's image

    [http://172.212.65.134/images/ ]

    [[http://172.212.65.134/youtube/]]

    Here is my result of images server and YouTube.

    User's image

    Reference: https://learn.microsoft.com/en-us/azure/application-gateway/create-url-route-portal#configuration-tab

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    I really appreciate your feedback. It’s valuable to us. Please click Accept Answer on this post to assist other community members facing similar issues in finding the correct solution


  2. UJTyagi-MSFT 930 Reputation points Microsoft Employee
    2025-04-23T10:38:31.37+00:00

    Hi @George Mathews ,

    Regarding you configuration you mentioned - both backend health status is healthy.

    Can you kindly confirm if you are using default health probe or custom health probe.

    If you are using the correct health probe configuration then even health probe as shown in the below image then then probe would be unhealthy as the backend server is giving 404 statuses as 404 by default comes under unhealthy status.

    User's image

    In addition to Venkat's answer if your backend VM does not have public ip address, you can try to access server 1 from server 2 and vice versa.

    http://<Server1>/images/
    http://<Server1>/youtube/
    

    If those return 404, the issue is with the web server configuration, not the application gateway. Anyway, i will wait for your response.

    Regards

    Ujjawal Tyagi

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.