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

Ability to have root urls instead of urls with path #23

Open RamjotSingh opened 4 years ago

RamjotSingh commented 4 years ago

Hybrid Connections do not allow root paths i.e. https://xyz.servicebus.windows.net instead the urls will always have paths in them (e.g. https://xyz.servicebus.windows.net/mymachinename). While this works well for non-view webservers, applications which serve CSS or JS files can sometimes trip because of this and instead of hitting https://xyz.servicebus.windows.net/mymachinename/myjs.js hit https://xyz.servicebus.windows.net/myjs.js. This is primarily due to the way webservers are written with assumption that they will be running at root.

One possibility to solve this would be running a FrontDoor resource in Azure which can translate from FrontDoor root url -> Hybrid Connection path based url.

Opening this issue to consider other such avenues.

damoodamoo commented 4 years ago

I just achieved this with a function proxy - little less fuss than front door perhaps -

{
    "$schema": "http://json.schemastore.org/proxies",
    "proxies": {
        "Teams": {
            "matchCondition": {
                "route": "/{*restOfPath}"
            },
            "backendUri": "https://my-namespace.servicebus.windows.net/my-path/{restOfPath}"
        }
    }
}

Working nicely so far - thanks for this repo!

AndrewCraswell commented 3 years ago

@RamjotSingh Has there been any update on this front? I'm working on a Teams app and we've hit this limitation using Create React App. There were a few folks who took a look at modifying our app to be compatible loaded as a path, since this has side benefits such as being able to deploy our PRs to Blob Storage for automatic PR previews. But turns out this approach was a little more difficult than seems necessary.

Any idea if there is another team doing something similar I could reach out to?

RamjotSingh commented 3 years ago

@AndrewCraswell I can give u a workaround. You can create a FrontDoor resource in azure and have that point to the relay. FrontDoor has ability to change outgoing urls. Which will allow you to do this.

I did not work on it, since their wasn't a lot of ask.

LeopoldLerch commented 3 years ago

As far as I can see this problem can be solved by using either a Function-Proxy or a Frontdoor. Whereas the frontdoor-solution might be the more expensive one, while providing more features such as WAF. Does one of them have any negative impacts I should consider?

RamjotSingh commented 3 years ago

Frontdoor is in general simpler, is closer to clients so tends to give better performance. However not a ton of difference in any url front you choose, atleast not for development purposes.