httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject ``Applies this URL to our current server?''
Date Fri, 13 Sep 1996 16:19:53 GMT

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

Mime
View raw message