Fix WebSocket proxy to respect HTTP_PROXY and custom CA certificates#87
Merged
shawnburke merged 1 commit intomainfrom Mar 9, 2026
Merged
Fix WebSocket proxy to respect HTTP_PROXY and custom CA certificates#87shawnburke merged 1 commit intomainfrom
shawnburke merged 1 commit intomainfrom
Conversation
keithfz
previously approved these changes
Mar 9, 2026
6b5a276 to
844bb15
Compare
keithfz
previously approved these changes
Mar 9, 2026
12bf20c to
3d5c65d
Compare
The WebSocket proxy code added in 36d35f7 was bypassing the configured HTTP transport, causing connection failures for customers using HTTP proxies with custom CA certificates. Changes: - dialWebSocketTarget now checks for proxy settings via the transport - Added dialThroughProxy() to establish HTTP CONNECT tunnels - getTLSConfig() reuses the transport's TLS config (including custom CAs) - Added Info-level logging for proxy vs direct connections Test improvements: - relay_test.sh now verifies WebSocket connections use proxy when configured - Added unit tests for proxy support and TLS config inheritance Fixes connection refused errors for customers behind corporate proxies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3d5c65d to
dd80201
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
relay_test.shwas designed to exercise this but did not strictly block access to thesnyk-brokercontainer, allowing it to pass when it should fail.Root Cause
The
dialWebSocketTargetfunction was usingnet.Dialerandtls.DialWithDialerdirectly, bypassing:http.ProxyFromEnvironmentTLSClientConfigChanges
reflector.go:
dialWebSocketTargetnow checks for proxy settings via the transportdialThroughProxy()to establish HTTP CONNECT tunnels through proxiesgetTLSConfig()to reuse the transport's TLS config (including custom CAs)getProxyURL()to respect transport proxy function or environment variablesreflector_test.go:
TestWebSocketProxyThroughHTTPProxy- verifies WebSocket works through HTTP CONNECT proxyTestGetTLSConfigFromTransport- verifies TLS config inheritanceTestGetTLSConfigWithoutTransport- verifies fallback behaviorrelay_test.sh:
PROXY=1Test plan
PROXY=1 ./relay_test.shto verify end-to-end proxy support🤖 Generated with Claude Code