Skip to content

Commit

Permalink
Merge pull request #140 from tnt-dev/host_header_on_redirect
Browse files Browse the repository at this point in the history
Rewrite 'host' header on redirect
  • Loading branch information
benoitc committed Dec 2, 2014
2 parents 211e642 + 45fa308 commit 266c509
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hackney_client/hackney.erl
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,9 @@ redirect(Client0, {Method, NewLocation, Headers, Body}) ->
#hackney_url{transport=RedirectTransport,
host=RedirectHost,
port=RedirectPort}=RedirectUrl,
RedirectRequest = make_request(Method, RedirectUrl, Headers, Body,
NewHeaders = lists:keystore(<<"Host">>, 1, Headers,
{<<"Host">>, RedirectHost}),
RedirectRequest = make_request(Method, RedirectUrl, NewHeaders, Body,
Client#client.options, false),
%% make a request without any redirection
#client{transport=Transport,
Expand Down

0 comments on commit 266c509

Please sign in to comment.