Revision 653332396238 () - Diff

Link to this snippet: https://friendpaste.com/62T88HOYw8QyaoIJoXEGXr
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/src/couchdb/couch_httpd_proxy.erl b/src/couchdb/couch_httpd_proxy.e
index dec3f55..07a6a28 100644
--- a/src/couchdb/couch_httpd_proxy.erl
+++ b/src/couchdb/couch_httpd_proxy.erl
@@ -21,10 +21,11 @@
handle_proxy_req(Req, ProxyDest) ->
+ {_, DestUrl} = get_urls(Req, ProxyDest),
Method = get_method(Req),
Url = get_url(Req, ProxyDest),
Version = get_version(Req),
- Headers = get_headers(Req),
+ Headers = get_headers(Req) ++ [{"Host", DestUrl#url.host}],
Body = get_body(Req),
Options = [
{http_vsn, Version},
@@ -89,6 +90,8 @@ to_ibrowse_headers([{K, V} | Rest], Acc) when is_list(K) ->
% This appears to make ibrowse too smart.
%"transfer-encoding" ->
% to_ibrowse_headers(Rest, [{transfer_encoding, V} | Acc]);
+ "host" ->
+ to_ibrowse_headers(Rest, Acc);
_ ->
to_ibrowse_headers(Rest, [{K, V} | Acc])
end.