question

TaB-8489 avatar image
0 Votes"
TaB-8489 asked azure-cxp-api edited

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

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-webapps-developmentazure-webapps-apis
image.png (15.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ajkuma-MSFT , Hey ajay.. Hwz going. All well? If you get some time could you please help me on this issue.

Thank you. Take care.

Regards
Tanul

0 Votes 0 ·

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered TaB-8489 commented

Hi @TaB-8489,

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

· 24
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ryanchill , thanks for sharing the details. But I’m unable to understand this line

except if another process in the same sandbox has created a listening socket on the destination port.


Does that mean running 2 api within same app service.

0 Votes 0 ·

Hi @TaB-8489, I jumped the gun a little early. I did update my response but let's step back a bit. To confirm, you asking about a virtual directory and not a virtual application, correct? If yes, virtual directory should be easily accessible as a relative path and both site/wwwroot and site/wwwroot/virtdir should run under the same w3wp process.

except if another process in the same sandbox has created a listening socket on the destination port

to me says if something like a nodejs process has port 3389 open, your MVC app can say https://localhost:3389/api/getdata is allowed from site/wwwroot.



0 Votes 0 ·

@ryanchill , Hey Ryan.
So basically what I will do is I will host one golang application at a random port placed in site\wwwroot directory whose end point will be http://azurexxxxxx.something.com/

Next golang app will act as a validator which I will host in site\test1 folder of same app service at random port and run at path /test1.

Now client from outside can also reach to other app at this url: http://azurexxxxxx.something.com/test1

But, I want to make a call to test1 from my first golang app as well. So, in that case is it possible to make http call to some localhost url. Because if my first app calls second via complete azure url then unnecessary network hops will come in the middle.

When they both are in same app service can they call each other internally.


Regards
Tanul

0 Votes 0 ·
Show more comments