RE: [users@httpd] (again) Can not define "default" name virtual host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Matus UHLAR - fantomas [mailto:uhlar@xxxxxxxxxxx] 
> > 
> > This is intended for some reason or another.  In the source, the
> > <VirtualHost> name is searched first (in order of appearance in conf
> > file) and returns a match before ServerName/Alias is even tried.

I would guess that the reason is to emulate the OSI model. The VH is defined by an IP address and port number, which are attributes of the TCP/IP layer. The ServerName is defined by a Host name, which is a header in the HTTP layer. The TCP/IP transport layer is more fundamental than the HTTP application layer so has to take precedence.

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> > There is even a comment in the source stating that "If this is a
> > NameVirtualHost then we may not be doing the Right Thing".  So you
> > could argue a bug, but this goes all the way through to 2.2.2 so it
> > will never be changed, heh.
> 
> I always thought it's a bug ;) Of course the judgement is not on me.
> 
> I guess, this functionality was created to make name-vhost 
> configurations
> like this one:
> 
> ###
> NameVirtualHost "host1"
> 
> <VirtualHost "host1">
> DocumentRoot /home/host1
> </VirtualHost>
> 
> <VirtualHost "host2">
> DocumentRoot /home/host2
> </VirtualHost>
> ###
> 
> ...work, where "host1" and "host2" point to the same address, 
> e.g. to make the
> move from ip-based to name-based vhosts a bit easier by 
> avoiding the need of
> using ServerName/ServerAlias. But that's just my guess, based 
> on config file
> I saw some time ago.
> 
> > So, as previously stated, just always configure your VH with
> > ServerName same as <VirtualHost> tag as the *first* one in the file.
> > This will work fine.
> 
> It won't work the desired way - as I said before, I want to 
> have virtual
> hosts that only applies to non-existing names...
> 
> > As for patching (not recommended), you could change
> > ap_matches_request_vhost in http_vhost.c to run the matches_aliases
> > before the VirtualHost name matches.
> 
> Or possibly to remove the VirtualHost names match at all? Or 
> do it only if
> no ServerName/ServerAlias is defined? Do you think that could break
> anything? (my problem is that thhe check is done at all).
> 
> ### However:
> 
> I found out this dirty workaround:
> 
> 1. put default.fantomas.sk to /etc/hosts:
> 
> 196.168.3.66	fantomas.fantomas.sk	default.fantomas.sk
> 
> (default.fantomas.sk is "virtual" name - it's designed not to 
> exist in DNS,
>  fantomas.fantomas.sk is main host name and for reverse 
> mapping it must be
>  the first, otherwise other apps may comply)
> 
> 2. use "NameVirtualHost default.fantomas.sk" directive
> 3. define virtualhosts on this fake host
> 
> This way it works as desired, and it also works, if other hosts then
> defauilt have "fantomas.fantomas.sk" or "195.168.3.66" in 
> <VirtualHost>, as
> long as there is in NameVirtualHost with the same value.
> 
> ### *This way it works
> 
> NameVirtualHost default.fantomas.sk:80
> # and also
> #NameVirtualHost fantomas.fantomas.sk:80
> 
> <VirtualHost default.fantomas.sk:80>
> ServerName default.fantomas.sk
> DocumentRoot /home/webs/default.fantomas.sk
> </VirtualHost>
> 
> <VirtualHost default.fantomas.sk:80>
> # or also
> #<VirtualHost fantomas.fantomas.sk:80>
> ServerName fantomas.fantomas.sk
> DocumentRoot /home/webs/fantomas.fantomas.sk
> </VirtualHost>
> 
> <VirtualHost default.fantomas.sk:80>
> # or also
> #<VirtualHost fantomas.fantomas.sk:80>
> ServerName 195.168.3.66
> DocumentRoot /home/webs/195.168.3.66
> </VirtualHost>
> 
> ### END *This
> 
> 
> Once recommended way - using * (even *:80) for 
> default.fantomas.sk, does NOT
> work, virtual host "default.nextra.sk" will never get 
> matched. That way
> fantomas.fantomas.sk and 195.168.3.66 match, and the default 
> is the first
> one of them.
> 
> Note I want these hosts only at _one_ IP address, so using 
> "*" for _all_
> hosts is not possible.
> 
> ### *This does NOT work
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
> ServerName default.fantomas.sk
> DocumentRoot /home/webs/default.fantomas.sk
> </VirtualHost>
> 
> NameVirtualHost 195.168.3.66:80
> 
> <VirtualHost 195.168.3.66:80>
> ServerName 195.168.3.66
> DocumentRoot /home/webs/195.168.3.66
> </VirtualHost>
> 
> <VirtualHost 195.168.3.66:80>
> ServerName fantomas.fantomas.sk
> DocumentRoot /home/webs/fantomas.fantomas.sk
> </VirtualHost>
> 
> ### END *This
> 
> Well, At least I know how to workaround this issue. I will 
> post comments to
> bug 39910... 
> 
> -- 
> Matus UHLAR - fantomas, uhlar@xxxxxxxxxxx ; http://www.fantomas.sk/
> Warning: I wish NOT to receive e-mail advertising to this address.
> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
> Fucking windows! Bring Bill Gates! (Southpark the movie)
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This e-mail is of a private and personal nature. It is not related to the exchange or business activities of the SWX Group. Le présent e-mail est un message privé et personnel, sans rapport avec l'activité boursière du Groupe SWX.
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux