After much pondering, I still think the VirtualHost design after Apache
1.2 is broken. I don't understand why this change was made.
I work at a web hosting company with many shared web servers, and almost
all name-based virtual hosting. So far, we've stuck with Apache 1.2 with
some 1.3 performance backports, for the main reason that the new
VirtualHost design is a pain to modify our scripts to and makes IP
migration without downtime pretty much impossible. Now that we are
facing a large IP migration project, I have started pondering this again.
Our configuration files are very simple: <VirtualHost somehost.com> for
each VirtualHost, that's it. Apache 1.2 nicely works out everything.
With a non-recursive nameserver setup, this setup is safe, fast, and easy
to manage. There are no IPs in the configuration file, and no need for
any. Scripts to manage the configuration files are very straight
forward.
My understanding on how Apache 1.2 versus Apache 1.3 handles requests
goes something like this:
1.2:
Startup:
- Parse each VirtualHost by resolving it and making a list of
sites for each IP. Hash each name for HTTP/1.1 requests.
Upon request:
- Look at "Host:" header. If known site, show that one. Stop.
- Look at connected IP. If known IP, show the first/last site
on the list of sites on that IP. Stop.
- Show the default site.
1.3:
Startup:
- Parse each VirtualHost by resolving it. If there is a
NameVirtualHost entry for this IP, hash this host under
the hash bucket for that IP; else, complain unless it is
the first.
Upon request:
- Look at IP. If known IP:
- Look at "Host:" header. If known site FOR THIS IP
ONLY, show that one. Stop.
else
- Host the first site for this IP. Stop.
- Host the default site.
So, well, what's the point? I don't see any advantage to this change.
I recall reading something about making it harder to show the wrong site
in the case of HTTP/1.0 requests which don't specify the host, but that's
why there should always be default site at the beginning/end for the
shared IP. That's all that's necessary.
With Apache 1.2, if you change IPs, you don't have to change the
configuration file. You don't even have to restart Apache! Only
HTTP/1.0 requests will have problems during the migration, just as they
would with Apache 1.3.
With Apache 1.3, you are screwed. The new IP will be useless until you
restart Apache, and then the old IP will be broken unless you have
manually duplicated the <VirtualHost> block in the configuration file so
that Apache will recognize it on both IPs.
I don't see why this change to make requests _more_ dependent on IP
address was made, especially with HTTP/1.1 supposed to be _removing_
dependencies on IPs. The browser is _never_ going to send the wrong
name, so why not always host the name if available?
So, basically, 1.3 VirtualHosts are slower (two hash lookups instead of
one), are harder to use (manual NameVirtualHost), and make IP migration
without downtime extremely difficult. Am I missing something?
Simon-
[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ [EMAIL PROTECTED] ][ [EMAIL PROTECTED] ]
[ Opinions expressed are not necessarily those of my employers. ]