[
https://issues.apache.org/jira/browse/HTTPCLIENT-2088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135673#comment-17135673
]
Oleg Kalnichevski commented on HTTPCLIENT-2088:
-----------------------------------------------
bq. And "Host" is a mandatory header and we populate it with the requested
domain.
[~preithig] No, you should not. You should let HttpClient generate mandatory
headers by correctly configuring the execution context. If you do, however,
then you should also disable automatic redirect handling and handle redirects
manually or provide a custom {{RedirectStrategy}} implementation.
Oleg
> Request headers directly copied to the redirect URL
> ---------------------------------------------------
>
> Key: HTTPCLIENT-2088
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2088
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: HttpClient (classic)
> Affects Versions: 4.5.3
> Reporter: Preethi
> Priority: Major
>
> We are using apache client in our project and using LaxRedirect strategy for
> redirect.
>
> When we hit the url and it is a redirect, the request headers from the
> original is copied to the headers of the redirect url as well. The host
> header is not changed to the url to the redirect server.
>
> Below is the code snippet from RedirectExec class
> HttpRequest redirect =
> this.redirectStrategy.getRedirect(currentRequest.getOriginal(), response,
> context);
> if (!redirect.headerIterator().hasNext())
> { HttpRequest original = request.getOriginal();
> redirect.setHeaders(original.getAllHeaders()); }
>
>
> Our redirect server is an S3 bucket
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]