I'm running an application with a web-interface behind an Apache
reverse proxy (from base). As this application is on the same host as
Apache it is running on another port (8080 instead of 80).
Unfortunately Apache sends back the wrong Host-Header. After carefully
checking the CVS-log for a bit of inspiration I found that a similar
problem was solved almost nine months ago [1]. When returning to an
older revision (1.19.2.1) of proxy_http.c my problems were gone. After
carefully looking at the code I think I have found a solution for the
former problem as well as my problem.

# diff -u proxy_http.c.orig proxy_http.c
--- proxy_http.c.orig   Tue Nov 23 12:05:25 2010
+++ proxy_http.c        Tue Nov 23 12:44:26 2010
@@ -367,7 +367,7 @@
                    AP_HOOK_DECLINE(DECLINED),
                    &rc, r, f, desthost, destportstr, destportstr);
         if (rc == DECLINED) {
-           if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)
+           if (destportstr != NULL || destport != DEFAULT_HTTP_PORT)
                ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);
            else
                ap_bvputs(f, "Host: ", desthost, CRLF, NULL);

What do you think?

[1] 
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/httpd/src/modules/proxy/proxy_http.c

Reply via email to