Skip to content
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

Forward proxy support for WebSocket #691

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Forward proxy support for WebSocket #691

merged 2 commits into from
Oct 24, 2023

Conversation

basil
Copy link
Member

@basil basil commented Oct 23, 2023

This component supports the http.proxyHost system property (or proxy_host environment variable) for configuring a proxy server, but it is not honored in WebSocket mode. By plumbing this through to Tyrus we can get Tyrus to respect the proxy settings the same way non-WebSocket mode does. Similarly we can plumb through the value of -proxyCredentials to Tyrus if the user needs to pass in a Proxy-Authorization header (like we do in non-WebSocket mode). We do this only for HTTP to match the non-WebSocket mode.

Testing done

Set up a Squid proxy that required authentication and verified that I could connect through it using:

java -Dhttp.proxyHost=${HOSTNAME} -Dhttp.proxyPort=3128 -jar target/remoting-999999-SNAPSHOT.jar -url ${JENKINS_URL} -secret ${SECRET} -name test -webSocket -proxyCredentials ${USERNAME}:${PASSWORD}

@basil basil added the enhancement For changelog: An enhancement providing new capability. label Oct 23, 2023

String proxyHost = System.getProperty("http.proxyHost", System.getenv("proxy_host"));
String proxyPort = System.getProperty("http.proxyPort");
if (proxyHost != null && "http".equals(hudsonUrl.getProtocol()) && NoProxyEvaluator.shouldProxy(hudsonUrl.getHost())) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compare with JnlpAgentEndpointResolver#openURLConnection

@basil basil merged commit c8c6efb into jenkinsci:master Oct 24, 2023
1 check failed
@basil basil deleted the proxy branch October 24, 2023 19:00
@basil basil changed the title Proxy support for WebSocket Forward proxy support for WebSocket Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For changelog: An enhancement providing new capability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants