Does HttpClient not send the "Proxy-Authorization" header along with
CONNECT request when we access the *HTTPS *url?

As I mentioned earlier,I tried *same *scenario to access the *HTTP *request
everything works fine.

http://hc.apache.org/httpcomponents-client-4.5.x/examples.html


Thanks,
Kaushal.

On Mon, Jul 15, 2019 at 3:02 PM Kaushal Kothari <
kaushalkothari2...@gmail.com> wrote:

> Just for clarification,I want to access the HTTPS url via proxy server and
> proxy server has the basic authentication set.
>
> In order to authenticate,"Proxy-Authorization Basic <encoded auth>" header
> should be sent along with CONNECT request but which is missing.
>
> you might have seen in last mail attached screenshot.If you are unable to
> see then let me know how can I send it to you again?
>
> So I created the POST request using the HttpPost class which is from the
> HttpClient API. HttpClient doesn't generate the "Proxy-Authorization Basic
> <encode_auth>" header so added the same and pass it to HttpClient to
> extract it from the POST request.
>
>  request = new HttpPost();   //please refer screenshot in last mail for
> details in request object
>  request.addHeader("Proxy-Authorization","Basic "+encodedAuth);
>  httpResponse = httpClientBuilder.execute(request);
>
>
>
> On Fri, Jul 12, 2019 at 5:55 PM Kaushal Kothari <
> kaushalkothari2...@gmail.com> wrote:
>
>> Hi Team,
>>
>> I am trying to do POC using the *HttpClient 4.5.5* library and want to
>> access *HTTPS url* masked through a http *proxy server* with *basic
>> authentication*
>> and its failing.
>>
>> The authentication proxy header should be sent as part of the connect but
>> it is not happening.
>>
>> I have also added the header "*Proxy-Authorization Basic <encodedAuth>*"
>> to *POST request *as it requires and passing request object to
>> httpclient through execute() method.
>>
>> Apart from that preemptive authentication is also set.
>>
>>
>> [image: image.png]
>>
>> But *over the network,* "*Proxy-Authorization Basic  <encodedAuth>*"
>> header is *missing*.
>>
>> I tried *same *scenario to access the HTTP request everything works fine.
>>
>> *On the fly* [No "Proxy-Authorization" header]:
>>
>> [image: image.png]
>> REQUEST:
>>
>> CONNECT localhost:4080 HTTP/1.1
>> Host: 127.0.0.1:9090
>> User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_191)
>>
>> RESPONSE:
>>
>> "HTTP/1.1 407 Proxy Authentication Required
>> Server: Proxy
>> Proxy-Authenticate: Basic realm="**** Authorization"
>> Cache-control: no-cache
>> Connection: Close
>> Proxy-Connection: Close
>> Content-Length: 0"
>>
>> Could you please help me on this issue? and let me know if you require
>> any further information.
>>
>> --
>> Thanks,
>> Kaushal.
>>
>

Reply via email to