]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix cache_peer forceddomainname when request has a Host header
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 25 Nov 2008 12:22:19 +0000 (13:22 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 25 Nov 2008 12:22:19 +0000 (13:22 +0100)
cache_peer forceddomainname=xxx only worked when the received request
did not have a Host header.

src/http.cc

index f20c942c9efd18ee8b600165df9be2ab841674aa..03b3d1f59f68e10e6eb231a747086678f5782119 100644 (file)
@@ -1698,8 +1698,9 @@ copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, St
          * went through our redirector and the admin configured
          * 'redir_rewrites_host' to be off.
          */
-
-        if (request->flags.redirected && !Config.onoff.redir_rewrites_host)
+       if (orig_request->peer_domain)
+            hdr_out->putStr(HDR_HOST, orig_request->peer_domain);
+        else if (request->flags.redirected && !Config.onoff.redir_rewrites_host)
             hdr_out->addEntry(e->clone());
         else {
             /* use port# only if not default */