details.html revision 27d310a14d63b16cccec3f3fffba5e1303233a53
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<TITLE>An In-Depth Discussion of Virtual Host Matching</TITLE>
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen BGCOLOR="#FFFFFF"
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen TEXT="#000000"
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen LINK="#0000FF"
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen VLINK="#000080"
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen ALINK="#FF0000"
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<!--#include virtual="header.html" -->
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<H1 ALIGN="CENTER">An In-Depth Discussion of Virtual Host Matching</H1>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>The virtual host code was completely rewritten in
4ee00532a265bdfb38539d811fcd12d51210ac35Timo SirainenThis document attempts to explain exactly what Apache does when
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainendeciding what virtual host to serve a hit from. With the help of the
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainennew <A HREF="/mod/core.html#namevirtualhost"><SAMP>NameVirtualHost</SAMP></A>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendirective virtual host configuration should be a lot easier and safer
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenthan with versions prior to 1.3.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainen<P>If you just want to <CITE>make it work</CITE> without understanding
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenhow, here are <A HREF="examples.html">some examples</A>.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>There is a <EM>main_server</EM> which consists of all
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo Sirainenthe definitions appearing outside of <CODE><VirtualHost></CODE> sections.
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo SirainenThere are virtual servers, called <EM>vhosts</EM>, which are defined by
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo Sirainen<A HREF="/mod/core.html#virtualhost"><SAMP><VirtualHost></SAMP></A>
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo Sirainen<P>The directives
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo Sirainen<A HREF="/mod/core.html#port"><SAMP>Port</SAMP></A>,
82130fea452f0bed0deb41405ccfedbf674e0e6cTimo Sirainen<A HREF="/mod/core.html#servername"><SAMP>ServerName</SAMP></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<A HREF="/mod/core.html#serverpath"><SAMP>ServerPath</SAMP></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<A HREF="/mod/core.html#serveralias"><SAMP>ServerAlias</SAMP></A>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainencan appear anywhere within the definition of
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainena server. However, each appearance overrides the previous appearance
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen(within that server).
efe78d3ba24fc866af1c79b9223dc0809ba26cadStephan Bosch<P>The default value of the <CODE>Port</CODE> field for main_server
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis 80. The main_server has no default <CODE>ServerPath</CODE>, or
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<CODE>ServerAlias</CODE>. The default <CODE>ServerName</CODE> is
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendeduced from the servers IP address.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainen<P>The main_server Port directive has two functions due to legacy
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainencompatibility with NCSA configuration files. One function is
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainento determine the default network port Apache will bind to. This
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendefault is overridden by the existence of any
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<A HREF="/mod/core.html#listen"><CODE>Listen</CODE></A> directives.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo SirainenThe second function is to specify the port number which is used
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainenin absolute URIs during redirects.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainen<P>Unlike the main_server, vhost ports <EM>do not</EM> affect what
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainenports Apache listens for connections on.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainen<P>Each address appearing in the <CODE>VirtualHost</CODE> directive
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainencan have an optional port. If the port is unspecified it defaults to
e563b8a1457be8c08cc7567043c9f06b8243a025Timo Sirainenthe value of the main_server's most recent <CODE>Port</CODE> statement.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo SirainenThe special port <SAMP>*</SAMP> indicates a wildcard that matches any port.
e563b8a1457be8c08cc7567043c9f06b8243a025Timo SirainenCollectively the entire set of addresses (including multiple
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenresults from DNS lookups) are called the vhost's <EM>address set</EM>.
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainen<P>Unless a <A HREF="/mod/core.html#namevirtualhost">NameVirtualHost</A>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendirective is used for a specific IP address the first vhost with
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenthat address is treated as an IP-based vhost. The IP address can also
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If name-based vhosts should be used a <CODE>NameVirtualHost</CODE>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendirective <EM>must</EM> appear with the IP address set to be used for the
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenname-based vhosts. In other words, you must specify the IP address that
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainenholds the hostname aliases (CNAMEs) for your name-based vhosts via a
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<CODE>NameVirtualHost</CODE> directive in your configuration file.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>Multiple <CODE>NameVirtualHost</CODE> directives can be used each
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenwith a set of <CODE>VirtualHost</CODE> directives but only one
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<CODE>NameVirtualHost</CODE> directive should be used for each
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenspecific IP:port pair.
798530867beda2d2d9a8ec194ea701adef74e737Timo Sirainen<P>The ordering of <CODE>NameVirtualHost</CODE> and
798530867beda2d2d9a8ec194ea701adef74e737Timo Sirainen<CODE>VirtualHost</CODE> directives is not important which makes the
798530867beda2d2d9a8ec194ea701adef74e737Timo Sirainenfollowing two examples identical (only the order of the
798530867beda2d2d9a8ec194ea701adef74e737Timo Sirainen<CODE>VirtualHost</CODE> directives for <EM>one</EM> address set
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis important, see below):
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen NameVirtualHost 111.22.33.44 | <VirtualHost 111.22.33.44>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <VirtualHost 111.22.33.44> | # server A
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainen # server A | </VirtualHost>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen ... | <VirtualHost 111.22.33.55>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen </VirtualHost> | # server C
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <VirtualHost 111.22.33.44> | ...
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen # server B | </VirtualHost>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen ... | <VirtualHost 111.22.33.44>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen </VirtualHost> | # server B
8ae72ad7d0c69e972cfa65d1e2ce4e3e9a8b765cTimo Sirainen NameVirtualHost 111.22.33.55 | </VirtualHost>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <VirtualHost 111.22.33.55> | <VirtualHost 111.22.33.55>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen # server C | # server D
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen </VirtualHost> | </VirtualHost>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <VirtualHost 111.22.33.55> |
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen # server D | NameVirtualHost 111.22.33.44
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen ... | NameVirtualHost 111.22.33.55
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen </VirtualHost> |
56a22540bdff919cdae86775396b905e2f28f6a9Timo Sirainen<P>(To aid the readability of your configuration you should prefer the
56a22540bdff919cdae86775396b905e2f28f6a9Timo Sirainenleft variant.)
56a22540bdff919cdae86775396b905e2f28f6a9Timo Sirainen<P> After parsing the <CODE>VirtualHost</CODE> directive, the vhost server
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis given a default <CODE>Port</CODE> equal to the port assigned to the
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenfirst name in its <CODE>VirtualHost</CODE> directive.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>The complete list of names in the <CODE>VirtualHost</CODE> directive
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenare treated just like a <CODE>ServerAlias</CODE> (but are not overridden by any
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<CODE>ServerAlias</CODE> statement) if all names resolve to the same address
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenset. Note that subsequent <CODE>Port</CODE> statements for this vhost will not
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenaffect the ports assigned in the address set.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>During initialization a list for each IP address
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis generated and inserted into an hash table. If the IP address is
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenused in a <CODE>NameVirtualHost</CODE> directive the list contains
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainenall name-based vhosts for the given IP address. If there are no
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenvhosts defined for that address the <CODE>NameVirtualHost</CODE> directive
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis ignored and an error is logged. For an IP-based vhost the list in the
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenhash table is empty.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>Due to a fast hashing function the overhead of hashing an IP address
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenduring a request is minimal and almost not existent. Additionally
c7db4d0d3caa2fc7a2afd7135fa5645862554156Timo Sirainenthe table is optimized for IP addresses which vary in the last octet.
c7db4d0d3caa2fc7a2afd7135fa5645862554156Timo Sirainen<P>For every vhost various default values are set. In particular:
c7db4d0d3caa2fc7a2afd7135fa5645862554156Timo Sirainen<LI>If a vhost has no
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#serveradmin"><CODE>ServerAdmin</CODE></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#resourceconfig"><CODE>ResourceConfig</CODE></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#accessconfig"><CODE>AccessConfig</CODE></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#timeout"><CODE>Timeout</CODE></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#keepalive"><CODE>KeepAlive</CODE></A>,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen <A HREF="/mod/core.html#sendbuffersize"><CODE>SendBufferSize</CODE></A>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen directive then the respective value is
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen inherited from the main_server. (That is, inherited from whatever
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen the final setting of that value is in the main_server.)
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<LI>The "lookup defaults" that define the default directory
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen for a vhost are merged with those of the main_server. This includes
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen any per-directory configuration information for any module.
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen<LI>The per-server configs for each module from the main_server are
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen merged into the vhost server.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo SirainenEssentially, the main_server is treated as "defaults" or a
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen"base" on which to build each vhost.
041cb02052c651cbaf6c2368bab34e24015b3392Timo SirainenBut the positioning of these main_server
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainendefinitions in the config file is largely irrelevant -- the entire
f32382d2da479a4371e08c443679528db37ea988Timo Sirainenconfig of the main_server has been parsed when this final merging occurs.
6004fdf3cc8fe87a6c35ce297d39ab68feb707b0Aki TuomiSo even if a main_server definition appears after a vhost definition
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenit might affect the vhost definition.
1382a978f06181d68151194ee4569378df16416aTimo Sirainen<P> If the main_server has no <CODE>ServerName</CODE> at this point,
1382a978f06181d68151194ee4569378df16416aTimo Sirainenthen the hostname of the machine that httpd is running on is used
1382a978f06181d68151194ee4569378df16416aTimo Siraineninstead. We will call the <EM>main_server address set</EM> those IP
1382a978f06181d68151194ee4569378df16416aTimo Sirainenaddresses returned by a DNS lookup on the <CODE>ServerName</CODE> of
1382a978f06181d68151194ee4569378df16416aTimo Sirainenthe main_server.
1382a978f06181d68151194ee4569378df16416aTimo Sirainen<P> For any undefined <CODE>ServerName</CODE> fields, a name-based vhost
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainendefaults to the address given first in the <CODE>VirtualHost</CODE>
1382a978f06181d68151194ee4569378df16416aTimo Sirainenstatement defining the vhost.
1382a978f06181d68151194ee4569378df16416aTimo Sirainen<P>Any vhost that includes the magic <SAMP>_default_</SAMP> wildcard
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenis given the same <CODE>ServerName</CODE> as the main_server.
da5c7f6eb2250089c74e00d3dc6284d43949f744Timo Sirainen<P>The server determines which vhost to use for a request as follows:
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainen<P>When the connection is first made by a client, the IP address to
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainenwhich the client connected is looked up in the internal IP hash table.
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainen<P>If the lookup fails (the IP address wasn't found) the request is
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainenserved from the <SAMP>_default_</SAMP> vhost if there is such a vhost
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainenfor the port to which the client sent the request. If there is no
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainenmatching <SAMP>_default_</SAMP> vhost the request is served from the
da5c7f6eb2250089c74e00d3dc6284d43949f744Timo Sirainen<P>If the IP address is not found in the hash table then the match
da5c7f6eb2250089c74e00d3dc6284d43949f744Timo Sirainenagainst the port number may also result in an entry corresponding to a
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainen<CODE>NameVirtualHost *</CODE>, which is subsequently handled like
311d3dd2078c1b711a0cef013ba43a94078c115cTimo Sirainenother name-based vhosts.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If the lookup succeeded (a corresponding list for the IP address was
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenfound) the next step is to decide if we have to deal with an IP-based
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenor a name-base vhost.
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen<P>If the entry we found has an empty name list then we have found an
f46fce070a135ec6bb3078c104f32651ea84cdefTimo SirainenIP-based vhost, no further actions are performed and the request is
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainenserved from that vhost.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If the entry corresponds to a name-based vhost the name list contains
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainenone or more vhost structures. This list contains the vhosts in the same
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainenorder as the <CODE>VirtualHost</CODE> directives appear in the config
6004fdf3cc8fe87a6c35ce297d39ab68feb707b0Aki Tuomi<P>The first vhost on this list (the first vhost in the config file with
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenthe specified IP address) has the highest priority and catches any request
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainento an unknown server name or a request without a <CODE>Host:</CODE>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If the client provided a <CODE>Host:</CODE> header field the list is
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainensearched for a matching vhost and the first hit on a <CODE>ServerName</CODE>
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenor <CODE>ServerAlias</CODE> is taken and the request is served from
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainenthat vhost. A <CODE>Host:</CODE> header field can contain a port number, but
539977f9257bd8985be5a8093658da266ae9cd19Timo SirainenApache always matches against the real port to which the client sent
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If the client submitted a HTTP/1.0 request without <CODE>Host:</CODE>
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainenheader field we don't know to what server the client tried to connect and
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainenany existing <CODE>ServerPath</CODE> is matched against the URI
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenfrom the request. The first matching path on the list is used and the
f32382d2da479a4371e08c443679528db37ea988Timo Sirainenrequest is served from that vhost.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If no matching vhost could be found the request is served from the
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenfirst vhost with a matching port number that is on the list for the IP
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainento which the client connected (as already mentioned before).
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo SirainenThe IP lookup described above is only done <EM>once</EM> for a particular
f46fce070a135ec6bb3078c104f32651ea84cdefTimo SirainenTCP/IP session while the name lookup is done on <EM>every</EM> request
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainenduring a KeepAlive/persistent connection. In other words a client may
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainenrequest pages from different name-based vhosts during a single
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenpersistent connection.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<P>If the URI from the request is an absolute URI, and its hostname and
f32382d2da479a4371e08c443679528db37ea988Timo Sirainenport match the main server or one of the configured virtual hosts
6004fdf3cc8fe87a6c35ce297d39ab68feb707b0Aki Tuomi<EM>and</EM> match the address and port to which the client sent the request,
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenthen the scheme/hostname/port prefix is stripped off and the remaining
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainenrelative URI is served by the corresponding main server or virtual host.
0c1ed553b9add66a85e908b0c783c1b0dee1e0feTimo SirainenIf it does not match, then the URI remains untouched and the request is
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainentaken to be a proxy request.
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen<LI>A name-based vhost can never interfere with an IP-base vhost and
f46fce070a135ec6bb3078c104f32651ea84cdefTimo Sirainen vice versa. IP-based vhosts can only be reached through an IP address
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen of its own address set and never through any other address.
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen The same applies to name-based vhosts, they can only be reached
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen through an IP address of the corresponding address set which must
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen be defined with a <CODE>NameVirtualHost</CODE> directive.
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen<LI><CODE>ServerAlias</CODE> and <CODE>ServerPath</CODE> checks are never
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen performed for an IP-based vhost.
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainen<LI>The order of name-/IP-based, the <SAMP>_default_</SAMP>
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen vhost and the <CODE>NameVirtualHost</CODE> directive within the config
2999c50f9ee8cbbfcb7c4a88c43cad3c6a5a5ff6Timo Sirainen file is not important. Only the ordering
041cb02052c651cbaf6c2368bab34e24015b3392Timo Sirainen of name-based vhosts for a specific address set is significant. The one
539977f9257bd8985be5a8093658da266ae9cd19Timo Sirainen name-based vhosts that comes first in the configuration file has
f32382d2da479a4371e08c443679528db37ea988Timo Sirainen the highest priority for its corresponding address set.
<!--#include virtual="footer.html" -->