hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Request loses authorization header when redirected by proxy
Date Tue, 03 Dec 2013 15:55:40 GMT
On Tue, 2013-12-03 at 15:51 +0000, Tobias Woerenkaemper wrote:
> Hi Oleg,
> 
> I am using httpclient 4.3.1 and configured my http client like this:
> 
>     HttpHost tmpProxy = new HttpHost("proxyhost", Integer.parseInt(####));
>     AuthScope tmpAuthScope = new AuthScope(tmpProxy);
>     BasicCredentialsProvider tmpCredentialsProvider = new BasicCredentialsProvider();
>     Credentials tmpCredentials = new UsernamePasswordCredentials("username", "****");
>     tmpCredentialsProvider.setCredentials(tmpAuthScope, tmpCredentials);
> 
>     RequestConfig tmpRequestConfig = RequestConfig.custom()
>       .setConnectTimeout(4000)
>       .setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC))
>       .setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC))
>       .build();
> 
>     HttpClient tmpClient = HttpClients.custom()
>       .setDefaultRequestConfig(tmpRequestConfig)
>       .setProxy(tmpProxy)
>       .setDefaultCredentialsProvider(tmpCredentialsProvider)
>       .setTargetAuthenticationStrategy(new SummonAuthenticationStrategy())
>       .build();
> 
> Now I am sending an http request with an Authorization/Authentication header since the
request target needs basic authentication as well:
> 
>     HttpGet tmpGetRequest = new HttpGet("target url");
>     tmpGetRequest.addHeader("Authorization", ".....");
> 
> While being routed through the proxy the (2nd) request seems to lose this authentication
header and hence I am getting a 401 by the target server.
> 
> Best Regards
> Tobias


Tobias,

Could you please post a wire / context log (obfuscated if necessary) of
the session?

Oleg


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


Mime
View raw message