Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 299676

Summary: www-servers/apache: Allow mod_status to show HTTP Host header instead of vhost name
Product: Gentoo Linux Reporter: David Abdemoulaie <gentoo-bugzilla>
Component: [OLD] ServerAssignee: Apache Team - Bugzilla Reports <apache-bugs>
Status: RESOLVED UPSTREAM    
Severity: enhancement    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description David Abdemoulaie 2010-01-04 22:27:41 UTC
I use mod_vhost_alias to manage my vhosts. I also sometimes enable mod_status with ExtendedStatus On to monitor/track performance. However, the apache scoreboard always uses the ServerName when showing the extended information.

I've figured out that it's fairly trivial to patch servers/scoreboard.c to show the HTTP Host request header instead of the vhost if it's present:

--- server/scoreboard.c.orig	2010-01-04 14:23:33.000000000 -0800
+++ server/scoreboard.c	2010-01-04 14:25:39.000000000 -0800
@@ -462,7 +462,9 @@
             apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config,
                         REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
             copy_request(ws->request, sizeof(ws->request), r);
-            apr_cpystrn(ws->vhost, r->server->server_hostname,
+	    vhost = apr_table_get(r->headers_in, "Host");
+	    vhost = vhost ? vhost : r->server->server_hostname;
+            apr_cpystrn(ws->vhost, vhost,
                         sizeof(ws->vhost));
         }
     }


This is done against the 2.2.14 source.



Reproducible: Always

Steps to Reproduce:
N/A

Actual Results:  
N/A

Expected Results:  
N/A
Comment 1 Benedikt Böhm (RETIRED) gentoo-dev 2010-01-07 07:36:26 UTC
please make feature requests in the upstream bugzilla