httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject r->hostname vs. s->server->server_hostname
Date Thu, 01 Jan 1998 22:17:00 GMT
background: say you want to use mod_rewrite to implement large numbers of
pseudo vhosts (without using real vhosts with their overhead), eg. one for
each user. It appears like this _almost_ works.  You need to make a custom
log using {Host}i to get the server name logged right, but that isn't a
big deal. 

The problem comes with when Apache has to generate the servername.  This
happens in several places, but one most visable externally is in the
creation of redirects; they get redirected to the ServerName name instead
of the pseudo-vhost name.

Why not use r->hostname instead of s->server_hostname for generating the
redirect URL (and possibly other things... but you have to be very careful
there...) if it is set?  This has the added advantages of eliminating all
the double auth problems when someone gets a redirect from http://site/foo
to in addition to fixing the redirect problem

The problem is that construct_url doesn't take the request_rec but only
the server_rec.  A new function could be added easily enough that took the
request_rec instead and did this, since all construct_url does is:

API_EXPORT(char *) construct_url(pool *p, const char *uri, const
server_rec *s)
    return pstrcat(p, "http://",
                   construct_server(p, s->server_hostname, s->port),
                   uri, NULL);

The disadvantage of this idea is that it doesn't discourage URL-variance,
however it isn't encouraging it; just lessening the effect of it changing
in midstream.  This would eliminate a lot of user problems since most
clients send the Host: header.


View raw message