-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support http proxy correctly #939
Conversation
I want to make another PR which closes #739 after this Pull Requests is merged. |
ping |
This PR changes how the package connects to HTTP proxies. Can this PR break applications that use HTTP proxies, or do all proxies support both modes (CONNECT vs no CONNECT)? |
Hey folks, can we add to this work to allow providing client certificates and also means to override the proxy server's CA cert pool? I assume plenty of folks out there (me included) use mTLS certificates for HTTPS proxy authentication. |
We need Canelohills question answered before we can decide next steps. |
Maybe as a quick work-around to unblock those of us waiting for this change, we can just turn the private function I've done that in a local (vendored) copy of this repo and I am able to register my custom dialer for "https" and got it to work. For @134130, here's some code that does what my dialer does... if anything for inspiration 😄:
|
I thought the PR is large enough. As I wrote above, the next PR will support TLS between client and proxy. Thanks! |
@adrianosela I removed |
Alright, now I'm lost 😅 where are we at now? |
@canelohill Sorry for the lack of explanation. The PR makes both of CONNECT and No CONNECT Proxy mode support.
|
IMO, |
@134130 Your comments do not address my question. Can this PR break an application that is currently using an HTTP proxy? This is a different question from what the package should do. Did you test the change with popular proxies? |
Oops, Sorry. Burp Suite will be broken with these changes. Previously, HTTP_PROXY didn't work correctly on me, and there was another issue that symptom is the same. But I think I've misconfigured the settings at that time. Because many client libraries are using No-Connect method for non-websocket requests (including SSE), but gorilla/websocket always uses Connect method, and It looks weird to me, and thats why I've thought that these changes are needed. I think this PR is no need to be merged. I'll make another PR which closes: #739. Sorry for wasting your time. |
I suspected that this PR would not work with a proxy server in the wild because the WebSocket protocol uses full-duplex data transmission. The HTTP protocol (and SSE layered on HTTP) uses half-duplex data transmission. The websocket protocol will not work through a proxy that assumes that all data transmission is half-duplex. The CONNECT method tells the proxy to get out of the way and just copy the data back and forth. |
What type of PR is this? (check all applicable)
Description
gorilla/websocket
's HTTP Proxy implementation is only supportsCONNECT
proxy, which can be called as "Tunnel Proxy".HTTP_PROXY
environment variable works as later one, and theHTTPS_PROXY
environment variable works as "Tunnel Proxy".curl
andgo http client
, follow this behavior.Related Tickets & Documents
Added/updated tests?
have not been included
Run verifications and test
make verify
is passingmake test
is passing