-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Proxy middelware - No TLS(https) support for Websocket #2200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bumping this, as I ran into this problem right now as well. As far as I examined the standard golang reverse proxy lib, there is a handler for WebSocket upgrades as well, so why not use that, instead of trying copying IO the raw way? |
Okay, just made an own proxy middleware copying the current implementation minus the extra raw handler for websockets. Works for secure WebSockets. Didn't test it for unencrypted connections though. |
@MatthiasWerning are you interested in creating PR for it? |
@aldas Sorry for responding late, I was a bit busy the recent days. I'm already creating a PR right now. However, for a unit test, that would require a server that upgrades your connection to a websocket and then test basic functionality. Upgrading and handling of messages is of course a bit more complicated when done manually and the well known gorilla/websocket library would simplify handling. That would require another dependency in the go.mod though. The current implementation however doesn't have any unit tests regarding web socket functionality anyway so I could skip that if wished. |
@aldas @MatthiasWerning @Harish09 It looks like this issue has been inactive for a while. I encountered the same problem and have created a PR to address it. |
Discussed in #2199
Originally posted by Harish09 June 9, 2022
Using Proxy middleware to proxy requests to a web server to multiple other services. Have configured the transport layer to support TLS for the proxy requests. But websocket TLS (wss://) requests are being proxied as requests without TLS (ws://) due to this code snippet in proxy.go
// Proxy switch { case c.IsWebSocket(): proxyRaw(tgt, c).ServeHTTP(res, req) case req.Header.Get(echo.HeaderAccept) == "text/event-stream": default: proxyHTTP(tgt, c, config).ServeHTTP(res, req) }
Is there a way to supply ProxyConfig to the websocket requests as well, so that the transport layer can be customised for TLS ?
The text was updated successfully, but these errors were encountered: