https://bz.apache.org/bugzilla/show_bug.cgi?id=64996

Christoph Anton Mitterer <cales...@scientia.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #3 from Christoph Anton Mitterer <cales...@scientia.net> ---
After playing around a bit more I'd even say two more points are missing from
vhosts/name-based.html AND in vhosts/details.html


I) Maybe I'm blind but after skimming through both several times I couldn't
find what happens if there are multiple <VirtualHost> blocks which "match" for
a request as good as each other (i.e. no ServerName/Alias match at all, or all
the names same).

It actually *is* indicated in mod/core.html#virtualhost, where it says:
"If multiple virtual hosts contain the best matching IP address and port, the
server selects from these virtual hosts the best match based on the requested
hostname. If no matching name-based virtual host is found, then the first
listed virtual host that matched the IP address will be used."

but it says this only for name based matching,... while it seems to be
generally the case, i.e. if I have:
<VirtualHost *:*>
  #vhost A
</VirtualHost>
<VirtualHost *:*>
  #vhost B
</VirtualHost>

then B, and only B, will be used, right?!



II) I thought a bit more about the "simple" selection algorithm I wrote down
above and the term "best match" and noticed that mine is also kinda flawed, but
the docs also don't seem to mentioned anywhere the real truth:

I wondered, what happens if I have:
<VirtualHost 10.10.10.10:*>
  #vhost A
</VirtualHost>
<VirtualHost *:8080>
  #vhost B
</VirtualHost>

and a request goes on to 10.10.10.10:8080 (regardless of whether name based or
not).

And in fact instead of:
- first, look at vhosts with a literal addr:port match (regardless whether
name-based or not)
- second, if none were found, look at those with wildcards

it seems the following is the case:

- first, look at vhosts with a literal addr:port match (regardless whether
name-based or not)
- second, if none were found, look at those with addr:* matches (where addr is
again literal)
- third, if none were found, look at those with *:port matches (where port is
again literal)
- fourth, if none were found, look at those with *:* matches.
- last but not least, use the main server

And in each[0] group:
- if Host-Header is given and matches, use that vhost
- if there were multiple vhosts with matching Host-Header, use the first one
(and only the first one) in the config file
- if there was only one vhost and/or no matches of the Host-Header or no
Host-header give, use the first vhost from the group (which explains both, why
the name based hosts-default to the first vhost,... and why e.g. two vhosts
with both *:*, or both *:80, or both 10.10.10.10 use the first)


Cheers,
Chris.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscr...@httpd.apache.org
For additional commands, e-mail: docs-h...@httpd.apache.org

Reply via email to