hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Wörenkämper (JIRA) <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1442) Request loses authorization header when redirected by proxy
Date Wed, 04 Dec 2013 07:37:35 GMT
Tobias Wörenkämper created HTTPCLIENT-1442:

             Summary: Request loses authorization header when redirected by proxy
                 Key: HTTPCLIENT-1442
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1442
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.3.1
            Reporter: Tobias Wörenkämper

While being routed through a proxy the (2nd) request loses the authentication header and hence
I am getting a 401 by the target server. In my case the target server does not challenge the
authentication which may be the reason (see logs).

I configured my HTTP client like this:
HttpHost proxy = new HttpHost("proxyhost", Integer.parseInt(####));
AuthScope authScope = new AuthScope(proxy);
BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
Credentials credentials = new UsernamePasswordCredentials("username", "****");
credentialsProvider.setCredentials(authScope, credentials);

RequestConfig requestConfig = RequestConfig.custom()

HttpClient client = HttpClients.custom()
    .setTargetAuthenticationStrategy(new SummonAuthenticationStrategy())
Then I am sending an HTTP request with an Authorization (Authentication) header since the
request target needs basic authentication as well:
    HttpGet getRequest = new HttpGet(“target url”);
    getRequest.addHeader("Authorization", "…..”);

Please also see the according hc-httpclient-users mailing list entry: http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201312.mbox/%3C644E476041F9FA46A339547A244DFFAE5FB6EA7B%40BYYZ5B.DE.bayer.cnb%3E.

This message was sent by Atlassian JIRA

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

View raw message