[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Question regarding proxy and SSL
From:       Ning Zhong <nzhong () me ! com>
Date:       2014-05-21 20:11:46
Message-ID: A5C82A49-FB04-4486-8A6E-6D36CBFD6085 () me ! com
[Download RAW message or body]


Hi, I am seeing an SSLException if I use a proxy: ( The IP Address and the Domain \
name below is altered by me).

javax.net.ssl.SSLException: hostname in certificate didn't match: <1.2.3.4> != \
<secure.bank.com> .  org.apache.http.conn.ssl.AbstractVerifier.verify 236
org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify 54
org.apache.http.conn.ssl.AbstractVerifier.verify 152
org.apache.http.conn.ssl.AbstractVerifier.verify 133
org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname 287
org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket 277
org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket 255
org.apache.http.impl.conn.HttpClientConnectionOperator.connect 118
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect 314
org.apache.http.impl.execchain.MainClientExec.establishRoute 371
…

If I do not use a proxy everything works.

My code:

CachingHttpClientBuilder builder = (CachingHttpClientBuilder) \
                CachingHttpClientBuilder.create().setCacheConfig(cacheConfig)
					.setKeepAliveStrategy(myStrategy).setConnectionManager(cManager);
CloseableHttpClient hClient = builder.build();

HttpGet httpget = new HttpGet(“https://secure.bank.com");
HttpHost proxy = new HttpHost( “1.2.3.4", 443, isHttps ? "https" : "http");
RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
httpget.setConfig(config);
HttpCacheContext context = HttpCacheContext.create();
response = client.execute(httpget, context);
…

BTW in my environment, 1.2.3.4 is the calculated IP address for secure.bank.com. So I \
am really trying to use the proxy as a way to route the request to the next hop. Am I \
doing it wrong?  Thanks
ning



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic