Application gateway URL path-based routing always redirect to default backend pool
Application gateway URL path-based routing always redirect to default backend pool
I have configured 4 webapps behind Application gateway (ARM template):
web app settings
I can open web apps when I go directly to dummyapiX.azurewebsites.de/servicehosts/dummyapiX.
I want routing work this way: when I go to https://PIPofApplicationGateway/servicehosts/dummyapiX it should redirect to
dummyapiX.azurewebsites.de/servicehosts/dummyapiX
But Application Gateway always redirect to default backend pool, therefore I get 404 error.
I created Custom probes that point to:
Backend health show Healthy status for all. Backend pools point to webapps FQDN. PickHostNameFromBackendAddress for httpsSettings and PickHostNameFromBackendHttpSettings for probes are set to true. No other Path related setting are not configured in httpsSettings.
The only path-based rule is:
Any suggestion? What might be a root cause?
2 Answers
2
Firstly, you can confirm if you have created the virtual directory in your web app setting. Make sure the URL-based rule maps to the specific backend pool. Create the basic listener with a listening request port. Create and map a Path-based rule and bind to the listener. Get more details from this tutorial.
Then, you can type ipconfig /flushdns
to clear the DNS cache In the command prompt console. Verify it again.
ipconfig /flushdns
Ref: Error 404 : Web App Not Found – Azure Web App
I've updated topic with screenshot of Web App settings
– minimuz
Aug 29 at 14:36
Can you show the Path-based rule and how to bind to the listener?
– Nancy Xiong - MSFT
Aug 29 at 14:44
I have only one HTTPS listener and one path-based rule that binded to this listener, It is 3 rules "/servicehosts/dummyapiX/*" to "backendpooldummyX"
– minimuz
Aug 29 at 14:54
tbh, this thing from tutorial bugs me: "Before we start to map this, we should know the route you mapped for your web apps should be the application root path of your web app " In my case WebApp VirtualDirectory settings are not as in tutorial, because WebApps are in subfolder /servicehosts/. Even if WebApps are accessible by URLs, it might not work with path-based routing
– minimuz
Aug 30 at 8:37
The root cause was trailing "/" in path in rules.
So instead of:
"/servicehosts/dummyapi1/*" to backendpooldummy1
"/servicehosts/dummyapi2/*" to backendpooldummy2
"/servicehosts/dummyapi3/*" to backendpooldummy3
It should be in my case
"/servicehosts/dummyapi1*" to backendpooldummy1
"/servicehosts/dummyapi2*" to backendpooldummy2
"/servicehosts/dummyapi3*" to backendpooldummy3
Now everything works
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
First, I can confirm that my webapp are created as indicated in tutorial. Second, clear DNS cache does not help
– minimuz
Aug 29 at 11:26