httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Covener" <>
Subject Re: [users@httpd] _default_ vs *, when do they differ?
Date Mon, 12 Jan 2009 12:24:24 GMT
On Mon, Jan 12, 2009 at 5:51 AM, André Warnier <> wrote:
> Eric Covener wrote:
>> Does anyone have a concrete example where the "_default_" and "*"
>> arguments to NameVirtualHost/VirtualHost behave different from
>> eachother?
> Whoever wrote these documentation pages seems to have been very, very
> thorough. But they are not really something "for the casual reader".
> Taking them at face value (which seems deserved here), it seems that
> _default_ is only really used with IP-based Vhosts, and never overlaps
> whatever NameVirtualHost covers.
> In other words (strictly following the doc pages and not by personal
> experience), it seems that

name-based vhost selection happens after ip-based, so they have to
interoperate. The doc is consistent in talking about _default_ for
ip-based and * for name-based, but I don't know if it's applicable

experimentation shows (AFAICT) there's "more than" no difference
relative to matching an NVH. Normally, the NVH match has to be exact
(i.e. a * doesn't "match" a specific IP NVH), but _default_:80 is
covered by NVH *:80 and visa-versa.

> <VirtualHost>
> <VirtualHost>
> <VirtualHost>
> <VirtualHost>
> to catch requests arriving via connections to these distinct IP addresses.
> - But you could also have VHosts as follows :
> <VirtualHost _default_:80>
> <VirtualHost>
> <VirtualHost>
> and the "_default_" VHost would then catch requests arriving on both the
> and addresses.
> - while if you did not have this VHost
> <VirtualHost _default_:80>
> then the requests arriving on the addresses and,
> would be handled using the "main" server configuration.

*:80 appears to do the same thing, though.

> NameVirtualHost
> <VirtualHost _default_:80>
> <VirtualHost>
> <VirtualHost>
> <VirtualHost>
>  Servername defaulthost
> </VirtualHost>
> <VirtualHost>
>  Servername
> </VirtualHost>
> <VirtualHost>
>  Servername
> </VirtualHost>
> and then :
> - requests arriving on the interface would be handled as
> name-based VHosts, according to their "Host:" header, and default to
> "defaulthost" if the "Host:" header was absent, or did not match any of
> "" or ""
> - requests arriving on the other interfaces would be handled according to
> the interface they arrive on, as before, and use the _default_ VHost unless
> they arrive on the interfaces or
> But, in such a configuration, specifying a VHost as
> <VirtualHost *:80>
> would not make sense, and probably generate an error at startup, because it
> does not match exactly any NameVirtualHost directive.

This does not generate errors. It matches any interface but doesn't
select based on ServerName/ServerAlias.

> And adding a directive
> NameVirtualHost *:80
> would not make sense either, considering the already-present Listen and
> VirtualHost directives with addresses.

Alone, this would generate a warning. With at least one virtualhost
matching exactly, it would work exactly as you want it.

Connections matching none of the specific IP addresses end up being
resolved to your set of VirtualHost *;80's, and then the Host: header
is used to select between them.

Eric Covener

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message