You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by D Kelmi <mi...@laudlink.ru> on 2003/12/05 16:02:17 UTC

Re[8]: [users@httpd] NameVirtualHost * with

Hello Boyle,

Friday, December 5, 2003, 5:09:12 PM, you wrote:

>> -----Original Message-----
>> From: D Kelmi [mailto:miksir@laudlink.ru]
>>
>>   But what i want to do:
>>      Apache listen more than one IP (now it's 2 IP, but it can be 8,
>>      16... or full C-class net)
>>      All IP's setup for name-based hosting (NameVirtualHost *)
>>      All domains assigned to one's IP (<VirtualHost 1.2.3.4>)
>>      How many domains hosted for each IP - to be of no importance.
>>      (!)I want to have one "dummy" VHs for each IP. If i remove some
>>      domains from config, this dummy site will be answer for requests
>>      for removed VHs and say "this domain not supported" or something
>>      else.

BO> I'm still not clear about what you want but I guess you want to have
BO> name-based on all IPs and if any site is not found it goes to a default
BO> site which is different for each IP. Then you should do:

  No, default site must be one for all IP.
  And i'm not want use a few default VHs with same DocumentRoot

BO> NVH 1.2.3.4
BO> <VH 1.2.3.4>
BO>  SN dummy_1234
BO> <VH 1.2.3.4>
BO>  SN site_1234_1
BO> <VH 1.2.3.4>
BO>  SN site_1234_2

BO> NVH 5.6.7.8
BO> <VH 5.6.7.8>
BO>  SN dummy_5678
BO> <VH 5.6.7.8>
BO>  SN site_5678_1
BO> <VH 5.6.7.8>
BO>  SN site_5678_2

BO> If you think this is too verbose, you might consider a perl-script to
BO> generate the config (or at least this part of it).

   i can :) but always try to find fine solution

>> 
>>    Yes, but if it's feature, not a bug - it's must be in
>>    documentation.

BO> Well, there is:
BO> http://httpd.apache.org/docs-2.0/vhosts/details.html...
BO> but I agree it is not obvious.

 Ok, i find this.

 A _default_ vhost catches a request only if there is no other vhost
 with a matching IP address and a matching port number for the
 request.... This also applies to NameVirtualHost * vhosts.

 It means, what VH * will be used only if not found VH 1.2.3.4.
 IMHO, it's not good :) It's not logically. Is the VH * always
 use with name-based vhost? In IP-based this construction lost
 meaning. If only in name-based, then

 NVH 1.2.3.4 - create name list for name-based vhost.
 NVH 5.6.7.8 - create name list for name-based vhost.
 VH 1.2.3.4 - add vhost structures to 1.2.3.4 name list
 VH * - add vhost structures to ALL name lists
 ....
 and more, more....
 Now, how i understand, it's otherwise
 NVH 1.2.3.4 - create name list for name-based vhost.
 VH * - add to '*' name list
 and apache check '*' name list after checking 1.2.3.4 name list

BO> Apache needs an unambiguous mapping of request to VH. The only
BO> attributes of the request are IP and Host (let's ignore port - same as
BO> IP). If you define NVH on all IPs and then define an IP-based VH, you
BO> create an ambiguity; for example:

BO> 	request(IP=1.2.3.4, Host=banana)
BO> 	NBVH(IP=any, Host=Banana)
BO> 	IPVH(IP=1.2.3.4)

BO> The request matches both so which is apache supposed to serve? When
BO> faced with a dilemma like this, TCP/IP attributes have to supersede HTTP
BO> headers. 

    If we're assume, what VHs with IP=any can use only for name-based
    vhosts, we solve this problem.
    request(IP=1.2.3.4, Host=banana)
    VH(IP=any, Host=Banana) - ignore, if IP-based; match if NVH 1.2.3.4 was used
    VH(IP=1.2.3.4) - match, if IP-based; if name-based, request already matched
    

BO> Rgds,

-- 
Best regards,
 D                            mailto:miksir@laudlink.ru


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org