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

List:       httpclient-users
Subject:    HTTPS Proxy using ProxySelectorRoutePlanner is not working as expected
From:       Ravi C Chamarthy <ravi.chamarthy () in ! ibm ! com>
Date:       2013-02-20 3:34:06
Message-ID: OF7026BAA3.6760E489-ON65257B18.001270C1-65257B18.00128428 () in ! ibm ! com
[Download RAW message or body]


Hi,

We use Apache HTTPClient to submit our requests to the target web
application hosted in WebSphere Liberty Application Server.
Scenario is to check HTTPS proxy with Apache HTTPClient.

I am using Fiddler2 as the HTTPS proxy and submitting the requests using
the Apache HTTPClient API.
And as mentioned in
[ http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e571 ]
 the following snippet works well where the requests are routed to the
proxy.
Here in the below code snippet the port 8888 is the fiddler port number and
the application server port is 9944.

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("localhost", 8888);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);


However, the actual requirement is to make use of the JRE proxy configured
at the system level, as detailed at:
[ http://www.java.com/en/download/help/proxy_setup.xml ], using which I
have setup the proxy as "locahost" and port as 8888.
I am using ProxySelector.getDefault() as mentioned in the code snippet from
[ http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e571 ].

DefaultHttpClient httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
        httpclient.getConnectionManager().getSchemeRegistry(),
        ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);

But the issue is, the request always goes directly to the target
application server and not going via., the proxy.
Is there any further httpclient configuration that I have to do?

Thanks,
Ravi Chamarthy


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

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

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