Skip to content

Commit 4ac56af

Browse files
committed
Always use HTTP to connect to proxy even when proxying HTTPS
The intention of the current implementation seems to be to have the normal proxy settings accomplish the same results with docker-java as they would in java in general. I think the one accidental divergence from that is that for the HTTPS case setting https.{proxy,port} would normally still use HTTP but in this case the code is- I think unintentionally- switching to the proxy connection to HTTPS. This change makes it so it corresponds better with how the java proxy properties work as well. Even when proxying HTTPS the connection to the actually proxy is done over HTTP and it makes a CONNECT call to stream the HTTPS over. Most proxies are still used via HTTP and for better or worse this is the assumption built into the java proxy configuration which docker-java is using. The apache client is more flexible and perhaps the docker-java configuration should be too but I'd like to argue that until then that the docker-java match the behavior of java. Also this allows me to use docker-java through the corporate proxy when proxying HTTPS. Otherwise HTTP works but HTTPS fails since the proxy is not configured with HTTPS.
1 parent e0d418b commit 4ac56af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private void configureProxy(ClientConfig clientConfig, String protocol) {
231231
String hostname = address.getHostName();
232232
int port = address.getPort();
233233

234-
clientConfig.property(ClientProperties.PROXY_URI, protocol + "://" + hostname + ":" + port);
234+
clientConfig.property(ClientProperties.PROXY_URI, "http://" + hostname + ":" + port);
235235

236236
String httpProxyUser = System.getProperty(protocol + ".proxyUser");
237237
if (httpProxyUser != null) {

0 commit comments

Comments
 (0)