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

Reply via email to