Apply the following patch to Apache 1.3.26 to get Apache 2.0's ProxyPreserveHost functionality. This is particularly useful when you need to learn HowToInstallLighttpdOnFreeBsdViaProxyPassThroughFromApache.
--- apache_1.3.26/src/modules/proxy/mod_proxy.h	Sun Apr 21 05:35:07 2002
+++ apache_1.3.26-deflate/src/modules/proxy/mod_proxy.h	Mon Jun 27 12:21:02 2005
@@ -192,6 +192,8 @@
     char *domain;               /* domain name to use in absence of a domain name in the request */
     int req;                    /* true if proxy requests are enabled */
     char req_set;
+    int phh;           /* true if we want to preserve the host header */
+    char phh_set;
     enum {
       via_off,
       via_on,
--- apache_1.3.26/src/modules/proxy/mod_proxy.c	Mon Jun 17 18:59:59 2002
+++ apache_1.3.26-deflate/src/modules/proxy/mod_proxy.c	Mon Jun 27 12:27:58 2005
@@ -436,6 +436,8 @@
     ps->viaopt_set = 0;         /* 0 means default */
     ps->req = 0;
     ps->req_set = 0;
+    ps->phh = 0;
+    ps->phh_set = 0;
     ps->recv_buffer_size = 0;   /* this default was left unset for some
                                  * reason */
     ps->recv_buffer_size_set = 0;
@@ -483,6 +485,7 @@
     ps->domain = (overrides->domain == NULL) ? base->domain : overrides->domain;
     ps->viaopt = (overrides->viaopt_set == 0) ? base->viaopt : overrides->viaopt;
     ps->req = (overrides->req_set == 0) ? base->req : overrides->req;
+    ps->phh = (overrides->phh_set == 0) ? base->phh : overrides->phh;
     ps->recv_buffer_size = (overrides->recv_buffer_size_set == 0) ? base->recv_buffer_size : overrides->recv_buffer_size;
     ps->io_buffer_size = (overrides->io_buffer_size_set == 0) ? base->io_buffer_size : overrides->io_buffer_size;
 
@@ -701,6 +704,18 @@
     return NULL;
 }
 
+static const char *
+    set_proxy_preserve_host(cmd_parms *parms, void *dummy, int flag)
+{
+    proxy_server_conf *psf =
+    ap_get_module_config(parms->server->module_config, &proxy_module);
+
+    psf->phh = flag;
+    psf->phh_set = 1;
+
+    return NULL;
+}
+
 
 static const char *
      set_cache_size(cmd_parms *parms, char *struct_ptr, char *arg)
@@ -936,6 +951,8 @@
     "a virtual path and a URL"},
     {"ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF, TAKE2,
     "a virtual path and a URL for reverse proxy behaviour"},
+    {"ProxyPreserveHost", set_proxy_preserve_host, NULL, RSRC_CONF, FLAG,
+    "on if the original Host: header should be preserved"},
     {"ProxyBlock", set_proxy_exclude, NULL, RSRC_CONF, ITERATE,
     "A list of names, hosts or domains to which the proxy will not connect"},
     {"ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF, TAKE1,
--- apache_1.3.26/src/modules/proxy/proxy_http.c	Mon Jun 17 18:59:59 2002
+++ apache_1.3.26-deflate/src/modules/proxy/proxy_http.c	Mon Jun 27 12:24:16 2005
@@ -311,11 +311,14 @@
     ap_hard_timeout("proxy send", r);
     ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.1" CRLF,
               NULL);
-    /* Send Host: now, adding it to req_hdrs wouldn't be much better */
-    if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)
-        ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);
-    else
-        ap_bvputs(f, "Host: ", desthost, CRLF, NULL);
+    /* Don't send Host: if we are preserving it */
+    if (!conf->phh) {
+        /* Send Host: now, adding it to req_hdrs wouldn't be much better */
+        if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)
+            ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);
+        else
+            ap_bvputs(f, "Host: ", desthost, CRLF, NULL);
+    }
 
     if (conf->viaopt == via_block) {
         /* Block all outgoing Via: headers */
@@ -383,7 +386,6 @@
          * Clear out hop-by-hop request headers not to send: RFC2616 13.5.1
          * says we should strip these headers:
          */
-            || !strcasecmp(reqhdrs_elts[i].key, "Host") /* Already sent */
             || !strcasecmp(reqhdrs_elts[i].key, "Keep-Alive")
             || !strcasecmp(reqhdrs_elts[i].key, "TE")
             || !strcasecmp(reqhdrs_elts[i].key, "Trailer")
@@ -400,6 +402,9 @@
          * was authenticated or not.
          */
             || !strcasecmp(reqhdrs_elts[i].key, "Proxy-Authorization"))
+            continue;
+        /* Don't drop Host: if we are preserving it */
+        if (!conf->phh && !strcasecmp(reqhdrs_elts[i].key, "Host"))
             continue;
         ap_bvputs(f, reqhdrs_elts[i].key, ": ", reqhdrs_elts[i].val, CRLF, NULL);
     }

-- [[canadaduane]]