How to route to another path with Azure Application Gateway?

旧巷老猫 提交于 2020-02-23 06:43:11

问题


I want to redirect a URL-path in my Azure Web App service to another URL-path using Azure Application Gateway. How to avoid redirection to include the original path?

I have an ASP.NET framework 4.7 Web App service in Azure with two APIs:

https://myapp.azurewebsites.net/api/values/{int}        -> respons 200
https://myapp.azurewebsites.net/api/forbidden           -> respons 403

Then I have an App Gateway

http://myapp.northeurope.cloudapp.azure.com

With path-based route

http://myapp.northeurope.cloudapp.azure.com -> https://myapp.azurewebsites.net (works ok)

And a permanent redirect to "external site"

/api/values/* -> http://myapp.northeurope.cloudapp.azure.com/api/forbidden

Now when I go to a path /api/values/1 it redirects me wrong to /api/forbidden/api/values/1

http://myapp.northeurope.cloudapp.azure.com/api/values/1 -> http://myapp.northeurope.cloudapp.azure.com/api/forbidden/api/values/1 !!!

Means redirection includes the origin path! "Include path" is not checked and greyed-out in configuration.

I only want to restrict the access to some API-path from public Internet.

来源:https://stackoverflow.com/questions/60300686/how-to-route-to-another-path-with-azure-application-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!