You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1996/09/13 18:19:53 UTC
``Applies this URL to our current server?''
Some people with virtual servers out there have the following problem on
redirects between virtual servers, which seems complicated to solve. The
problem for mod_rewrie is the question:
``Applies this URL to our current server?''
In other words:
``How could a module determine if the URL http://host:port/url/ really
applies to the current (virtual) server instance?''
The problem comes from the three situations:
o server is a non-virtual server (i.e. the main server)
o server is a ip-based virtual server (ifconfig alias)
o server is a non-ip-based virtual server (HTTP/1.1 Host: || ServerPath /url)
For the first situation there are a lot of good working solutions, for
instance I could do
ourhost = gethostbyname(r->server->server_hostname)
testhost = gethostbyname(host)
for all ip-adresses of ourhost
for all ip-adresses of testhost
if match then this is our server
BUT: Do anyone know a correct check for the other two situations?
The above approach will not work because in situation two not all
ip-addresses could used and in situation three the Host: header,
ServerAlias and ServerPath have to keep in mind. For virtual servers
there are a lot of special context things which the check has to know
about.
Any pseudo-code solutions for situation two and three?
Ralf S. Engelschall
rse@engelschall.com
http://www.engelschall.com/~rse
Re: ``Applies this URL to our current server?''
Posted by Dean Gaudet <dg...@hotwired.com>.
In article <ho...@en.muc.de>,
Ralf S. Engelschall <ne...@hyperreal.com> wrote:
> ``How could a module determine if the URL http://host:port/url/ really
> applies to the current (virtual) server instance?''
Isn't that gear already in read_request and its children?
I'm biased against the webserver going about trying to guess what
the adminstrator wants. If we borrow from sendmail we'll notice that
the w class needs to be configured by the administrator -- it doesn't
go about looking at MX records to find out if it should be handling
the request.
read_request and its children use ServerAlias, ServerPath and <VirtualHost>
as hints to figure out what vhost to use. If that functionality was
modularized you'd be able to use it in mod_rewrite.
Dean