The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Virtual web sites and and older browsers 18 January 2000
Share
Need more help on this topic? Click here
This article has no comments
Show me similar articles
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.

Share
Need more help on this topic? Click here
This article has no comments
Show me similar articles