[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949942#comment-17949942
 ] 

Sneha Murganoor edited comment on HTTPCLIENT-2369 at 5/7/25 9:36 AM:
---------------------------------------------------------------------

Thanks for the response, but I'm a bit confused. The Classic Apache HTTPClient 
does seem to work with HTTPS proxy tunneling in my implementation. Here's my 
working code:
{code:java}
HttpClientBuilder builder; 
builder.disableConnectionState();
..
HttpRoutePlanner planner = (target, context) -> {             
HttpHost httpHost = new HttpHost("https", target.getHostName(), 443);    
HttpHost proxy = new HttpHost("https", "server.com", 443);               
HttpRoute route = new HttpRoute(httpHost, null, proxy, true, 
RouteInfo.TunnelType.TUNNELLED, RouteInfo.LayerType.LAYERED);                  
return route; 
}
builder.setRoutePlanner(planner);
this.client = builder.build();
 
response = this.client.execute(request, context);
log.info("Request isTunneled: " + context.getHttpRoute().isTunnelled());
log.info("Proxy: " + context.getHttpRoute().getProxyHost());
{code}
The logs confirm the tunnel is established:
{code:java}
Request isTunneled: true

Proxy: https://server.com/
{code}

Am I misunderstanding something here? The tunnel appears to be working 
correctly with an HTTPS proxy. Could you clarify if there's a specific 
limitation or issue I should be aware of, even though it seems to be working?

I'd appreciate any insights into whether this approach might have hidden 
problems or if there's something I'm missing about the implementation.




was (Author: JIRAUSER309632):
But I see Classic Apache HTTPClient works. 

{code}
HttpClientBuilder builder; 
builder.disableConnectionState();
..
HttpRoutePlanner planner = (target, context) -> {             
HttpHost httpHost = new HttpHost("https", target.getHostName(), 443);    
HttpHost proxy = new HttpHost("https", "server.com", 443);               
HttpRoute route = new HttpRoute(httpHost, null, proxy, true, 
RouteInfo.TunnelType.TUNNELLED, RouteInfo.LayerType.LAYERED);                  
return route; 
}
builder.setRoutePlanner(planner);
this.client = builder.build();
 
response = this.client.execute(request, context);
log.info("Request isTunneled: " + context.getHttpRoute().isTunnelled());
log.info("Proxy: " + context.getHttpRoute().getProxyHost());
{code}

I see 
{code}
Request isTunneled: true

Proxy: https://server.com/
{code}

> Does HttpAsync Client Support Proxy Tunnel
> ------------------------------------------
>
>                 Key: HTTPCLIENT-2369
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2369
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async)
>    Affects Versions: 5.4
>            Reporter: Sneha Murganoor
>            Priority: Major
>
> I'm working on implementing a client that needs to connect to HTTPS endpoints 
> through an HTTPS proxy. I'd like to use 
> CloseableHttpAsyncClient/InternalHttpAsyncClient from Apache HttpComponents 
> AsyncClient library for this purpose. Does it support HTTPS proxy tunneling 
> to HTTPS targets?
> Also, if CloseableHttpAsyncClient//InternalHttpAsyncClient isn't suitable for 
> this scenario, what alternatives would you recommend?
>  
> Thanks in Advance,
> Sneha



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to