ioBroker / ioBroker.proxy

This adapter allows to access other web servers over web adapter.
MIT License
6 stars 6 forks source link

Remove requirement that paths be under '/proxy.0/...' #133

Open raintonr opened 7 months ago

raintonr commented 7 months ago

Currently it seems that all proxy paths must exist under a 'root' path that includes the adapter number. Ie, /proxy.0/...

This is not ideal as some external services have fixed paths that must be routed. Ie. imagine one wants to route ACME challenge requests that come to http://<host>/.well-known/acme-challenge/...

Indeed, this restriction is known and noted as not ideal in the Adapter documentation ("Not all devices can be accessed via proxy.") so would be useful to remove such a restriction.

As part of this allowing host/name based forwarding might also be very useful.

Apollon77 commented 7 months ago

Hm ... normally the "route" parameter should allow exactly this already... https://github.com/ioBroker/ioBroker.proxy/blob/master/lib/proxy.js#L43 ... does that not work?

raintonr commented 7 months ago

The configuration instructions say:

Route path: Path for proxy. If "/proxy.0", so the routes will be available under http://webIP:8082/proxy.0/...

Are you saying this is optional and if one sets the Route path to blank they can forward any path?

If the Route path is indeed configurable on a per-instance basis, that has consequences for #134. Either a rule would need the ability to override the Route path, or an intermediary library, when called to setup an automatic rule, would need to seek out a proxy which has a compatible Route path, port, etc. and throw an error if none is found.

Apollon77 commented 7 months ago

When I read the linked code then, no "empty" will not work, but a "/" should work ... Then the route would be "empty" after it because a trailing slash gets removed