Calling from one path to another virual path in same Azure App service?

Tanul 1,251 Reputation points
2021-03-17T10:59:07.877+00:00

Team,

If we host 2 small api within same app service and provide their virtual path like this

78709-image.png

Then, is it possible to enable calls between them through urls like this

http:// 127.0.0.1/site1 or http://localhost/site1

I can use the complete url but in that case unnecessary hops of api gateway or routers will come in the middle.

In my case, the request will only come to service sitting at wwwroot along with its token. Now, this service will redirect the call to site1(test1) service for validation process because site1 service manages token creation and validation process.

Can anyone let me know if it is possible.

Regards,
Tanul

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,876 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,666 Reputation points Microsoft Employee
    2021-03-18T02:59:26.407+00:00

    Hi @Tanul ,

    You will need to use the public facing DNS name, e.g., https://yourapp.azurewebsites.net to https://youapp.azurewebsites.net/test1 as calls to localhost will fail with an exception. See https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#local-address-requests

    EDIT: If you're using virtual directories, then you should be able to use relative paths e.g. ~/test1; however, using the app service host name is recommended to avoid any issues.

    Regards,
    Ryan