httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject RE: NameVirtualHost
Date Sun, 26 Oct 1997 00:45:19 GMT

Careful you don't tred on the worms about to come out of this can..

The problem with the current system (and the old one too) is that it's
just too damn confusing considering all the different ways people want
to use it and expect it to work. How about this completely different


Add a new directive. For want of a better name 'Service' will do for the

Service [hostname]:[ip]:[port] some-alias
  with all the []s being optional   e.g.

Service registered
   # name based only on port 80 - who cares what IP it came in on
Service mainserver
   # ditto
Service ::79 otherport
   # catch anything on port 79.
Service customer_23
   # any port, name based "" but also on IP
Service : customer_24
   # any port, any name, on IP
Service ::: mainserver
   # pickup anything that has not been caught
   # if there are any 'Service' directives there must be a ":::" one too.

<VirtualHost mydefault>
  :  :  : 

<VirtualHost otherport>
  :  :  :

<VirtualHost registered>
  :  :  :

<VirtualHost customer_24>
  :  :  :

<VirtualHost customer_23>
  :  :  :


If a request arrives with attributes 'a:b:c' it can be compared
against each of the 'Service' attributes 'x:y:z'.

foreach x:y:z (Service) {
 score = 0
 if  (x!='' && x!=a) || (y!='' && y!=b) || (z!='' && z!=c)  do next

 score = 1
 if  x!=''   score += 1   # a matching hostname is something to cheer about.
 if  z!=''   score += 2   # a matching port is better than a matching hostname.
 if  y!=''   score += 4   # a matching IP is always the best choice.

::: will always score 1 and be a better choice than those rejeted with
a score of 0.

The entry with the highest score is used to choose the VirtualHost config
to use. This way there's no hidden ordering and the logic is reasonably
easy to follow and document.

Rob Hartill                              Internet Movie Database (Ltd)   .. a site for sore eyes.

View raw message