OfficeDev / microsoft-teams-tunnelrelay

Tunnel relay allows you to expose local services to the outside world over HTTPS
MIT License
81 stars 18 forks source link

How to retrieve the public facing endpoint ? #38

Open stevebeauge opened 2 years ago

stevebeauge commented 2 years ago

I'm prototyping this tools and it looks far more reliable than other free tunneling tools I tested.

However, I need to dynamically know what the exposed endpoint. When the local server get the request, the host header is localhost.

I can there is a via header, but it only contains the relay host url, not the full url.

Is there any way to retrieve the original url ?

FYI, here's the details of my setup:

The service behind 7071 port is the local azure function host emulator.

Is use this to implement some SharePoint Addins and the exact exposed url is important because of some callback urls returned by the function. I may add the url as part of the function settings, but it would simplier I guess to just get the actual URL from, why not, a TunnelRelay specific header ?

RamjotSingh commented 2 years ago

The original url is dropped (since request is replaced). You can however write a middleware and push that info in the outgoing request probably?

https://github.com/OfficeDev/microsoft-teams-tunnelrelay/blob/master/Documentation/PluginManagement.md

Let me know if this helps

stevebeauge commented 2 years ago

Thanks for the suggestion. I tried to write a plugin, but unfortunately, plugin has no access (as far as I know) to the incoming relayed request.

RamjotSingh commented 2 years ago

The incoming Path and Query are same unless you add a prefix to it, so your plugin can make those assumptions if you do not intend to make it super generic.

Other option would be to load appSettings.json and read redirectionUrl and hybridConnectionUrl from it. Compare it with Path and Query of outgoing request to service running locally. That should give you information about the original url.