Virtual web sites and and older browsers

Virtual web sites and and older browsers

If you are using virtual websites, you
should be aware that this feature is HTTP 1.1 specific and will not work with older
browsers.  This article discusses an option which you can use to access to your
virtual websites for users with non-HTTP 1.1 browsers.

The following resources will
probably help you to understand this issue.  I didn’t find them much help in solving
this issue, but they did provide useful insight.

Apache name-based Virtual Host Support
http://www.apache.org/docs/vhosts/name-based.html

Using the ServerPath directive
http://www.apache.org/docs/vhosts/examples.html#serverpath

Details of name-based virtual hosts

Name based virtual hosts use a feature of the HTTP 1.1 protocol which
involves sending the host name from the client to the server.  The server uses this
name to determine which virtual website to display.  This host name must appear in
httpd.conf as a ServerName entry in one of the virtual host entries.  The
default web site will be supplied if no match is found.

HTTP 1.0 browsers do not send
the host name.  In this case, the default web site will be displayed.

What do HTTP 1.0 browsers see?

To test what older browsers will see, enter your web server’s IP address
into your browser.  That should show you.

See also Virtual
websites – what non-HTTP/1.1 compatible browsers will see
for more detail.

A solution

My solution was to create a new virtual host and put it in front of all
other virtual hosts.  Here’s the entry:

<VirtualHost 10.0.0.1>
    ServerAdmin         webmaster@yourdomain.org
    DocumentRoot        /www/default
    ServerName          default.yourdomain.org
    ErrorLog            /www/logs/default-error.log
    CustomLog           /www/logs/default-access_log common
</VirtualHost>

The next step is to create symbolic links from within /www/default to your
various virtual websites.  See also Creating a symbolic link.
  I recommend creating a single page for your default website.  See http://default.unixathome.org/ for what I did.

Remember to add a DNS entry for default.yourdomain.org.

A quick and dirty solution

Another way you can do this is this:

<VirtualHost 10.0.0.1>
    ServerAdmin         webmaster@yourdomain.org
    DocumentRoot        /www/
    ServerName          default.yourdomain.org
    ErrorLog            /www/logs/default-error.log
    CustomLog           /www/logs/default-access_log common
</VirtualHost>

This assumes all of your websites are located in /www.  If this is the
case, then older browsers will see a directory listing of all the websites.  This
will work, but it’s not pretty.

Leave a Comment

Scroll to Top