abhinavsingh / proxy.py

💫 Ngrok FRP Alternative • ⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • 👮🏿 "Proxy Server" framework • 🌐 "Web Server" framework • ➵ ➶ ➷ ➠ "PubSub" framework • 👷 "Work" acceptor & executor framework
https://abhinavsingh.com/proxy-py-a-lightweight-single-file-http-proxy-server-in-python/
BSD 3-Clause "New" or "Revised" License
3.01k stars 573 forks source link

Reverse proxy plugin to support WebSockets #1271

Open thatsheepishcoder opened 2 years ago

thatsheepishcoder commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently, the reverse proxy plugin setup doesn't support proxying over websocket connections. This means proxy.py is unsuitable for applications that require websocket and http functionality (for example, JupyterLab).

Describe the solution you'd like

Inbuilt support for websocket connections through the reverse-proxy plugin.

Additional context

The current implementation will result in websocket connections being handled by the web server plugin, rather than passing the connection through to the Reverse Proxy plugin. If you spin up a reverse-proxy plugin and then attempt to pass a websocket connection, you will see mentions of the webserver handling the connection in the proxy.py logging.

Initially, it looks like it needs to be added as a valid route in ReverseProxy class (proxy.http.server.reverse, line 53-54), however the class also does not have implemented functionality for websocket upstream passing.

abhinavsingh commented 2 years ago

@thatsheepishcoder Thanks for raising this. I have been trying to pull in full proxy-server style support within reverse-proxy chain. This will likely land in the next release.

nicknotfun commented 1 year ago

Just checking in on this actually, ran into the same limitation?