Received: by taz.hyperreal.com (8.8.4/V2.0) id LAA06160; Sun, 23 Mar 1997 11:26:47 -0800 (PST) Received: by taz.hyperreal.com (8.8.4/V2.0) id LAA06130; Sun, 23 Mar 1997 11:26:44 -0800 (PST) Date: Sun, 23 Mar 1997 11:26:44 -0800 (PST) From: Dean Gaudet Message-Id: <199703231926.LAA06130@taz.hyperreal.com> To: apache-cvs@hyperreal.com Subject: cvs commit: apache/htdocs/manual vhosts-in-depth.html Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com dgaudet 97/03/23 11:26:43 Modified: htdocs/manual vhosts-in-depth.html Log: Added some more notes based on observations from Brent Holland . Revision Changes Path 1.2 +29 -9 apache/htdocs/manual/vhosts-in-depth.html Index: vhosts-in-depth.html =================================================================== RCS file: /export/home/cvs/apache/htdocs/manual/vhosts-in-depth.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C3 -r1.1 -r1.2 *** vhosts-in-depth.html 1997/03/20 23:31:45 1.1 --- vhosts-in-depth.html 1997/03/23 19:26:42 1.2 *************** *** 56,62 **** first name in its VirtualHost directive. The complete list of names in the VirtualHost directive are treated just like a ServerAlias (but are not overridden by any ! ServerAlias statement).

All vhosts are stored in a list which is in the reverse order that --- 56,64 ---- first name in its VirtualHost directive. The complete list of names in the VirtualHost directive are treated just like a ServerAlias (but are not overridden by any ! ServerAlias statement). Note that subsequent Port ! statements for this vhost will not affect the ports assigned in the ! address set.

All vhosts are stored in a list which is in the reverse order that *************** *** 118,126 ****

Now a pass is made through the vhosts to fill in any missing ServerName fields and to classify the vhost as either ! an ip-based vhost or a name-based vhost. A vhost is an ! ip-based vhost if none of the vhosts address set overlaps the main_server ! address set. Otherwise it is considered a name-based vhost.

For any undefined ServerName fields, a name-based vhost defaults to the address given first in the VirtualHost --- 120,130 ----

Now a pass is made through the vhosts to fill in any missing ServerName fields and to classify the vhost as either ! an ip-based vhost or a name-based vhost. A vhost is ! considered a name-based vhost if any of its address set overlaps the ! main_server (the port associated with each address must match the ! main_server's Port). Otherwise it is considered an ip-based ! vhost.

For any undefined ServerName fields, a name-based vhost defaults to the address given first in the VirtualHost *************** *** 141,147 ****

find_virtual_server: When the connection is first made by the client, the local ip address (the ip address to which the client connected) is looked up in the server list. A vhost is matched if it ! is an ip-based vhost, and the ip address matches and the port matches (taking into account wildcards).

If no vhosts are matched then the last occurance, if it appears, --- 145,151 ----

find_virtual_server: When the connection is first made by the client, the local ip address (the ip address to which the client connected) is looked up in the server list. A vhost is matched if it ! is an ip-based vhost, the ip address matches and the port matches (taking into account wildcards).

If no vhosts are matched then the last occurance, if it appears, *************** *** 185,191 **** of this match is to compare any port, if one was given in the request, against the Port field of the connection vhost. If there's a mismatch then the vhost used for the request is the connection vhost. ! (This is probably a bug.)

If the port matches, then httpd scans the list of vhosts starting with --- 189,195 ---- of this match is to compare any port, if one was given in the request, against the Port field of the connection vhost. If there's a mismatch then the vhost used for the request is the connection vhost. ! (This is a bug, see observations.)

If the port matches, then httpd scans the list of vhosts starting with *************** *** 199,206 **** ServerName and Port.

  • Compare the request hostname against any and all addresses given in ! the VirtualHost directive for this vhost. (n.b. this ! assumes Dean's "VirtualHost confusion" patch is accepted.)
  • Compare the request hostname against the ServerAlias given for the vhost. --- 203,209 ---- ServerName and Port.
  • Compare the request hostname against any and all addresses given in ! the VirtualHost directive for this vhost.
  • Compare the request hostname against the ServerAlias given for the vhost. *************** *** 275,281 **** another ServerPath directive that appears later in the configuration file, then the former will always be matched and the latter will never be matched. (That is assuming that no ! Host header was available to disambiguate the two.) --- 278,301 ---- another ServerPath directive that appears later in the configuration file, then the former will always be matched and the latter will never be matched. (That is assuming that no ! Host header was available to disambiguate the two.)

    ! !
  • If a vhost that would otherwise be a name-vhost includes a ! Port statement that doesn't match the main_server ! Port then it will be considered an ip-based vhost. ! Then find_virtual_server will match it (because ! the ports associated with each address in the address set default ! to the port of the main_server) as the connection vhost. Then ! check_hostalias will refuse to check any other name-based ! vhost because of the port mismatch. The result is that the vhost ! will steal all hits going to the main_server address.

    ! !
  • If two ip-based vhosts have an address in common, the vhost appearing ! later in the file is always matched. Such a thing might happen ! inadvertantly. If the config has name-based vhosts and for some reason ! the main_server ServerName resolves to the wrong address ! then all the name-based vhosts will be parsed as ip-based vhosts. ! Then the last of them will steal all the hits.