You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hajo Locke <Ha...@gmx.de> on 2015/12/29 20:05:25 UTC

[users@httpd] unexpected behaviour of default host

Hello List,

used for years apache 2.2, now trying to upgrade to 2.4 and do some 
configtests.
I noticed an unexpected behaviour of default host.
like suggested here, i use a minimal default vhost:
https://httpd.apache.org/docs/2.4/vhosts/examples.html
<VirtualHost_default_:*>
DocumentRoot"/www/default"
</VirtualHost>

In Apache 2.2 we used additional "Servername *", but with 2.4 it is not 
allowed to use wildcards with Servername-Directive.
So we leave it empty like suggested in the docs. First loaded valid 
VHost will be the default host.
I think the missing Servername is internal evaluated and filled with 
hostname of local machine. I did a lot of tests and this is my only 
conclusion.
So this leads to problems when using local hostname in other VHosts as 
Servername, which may lead now to wrong Documentroots. We do it this way 
on a couple of thousend servers. I think this happens also to the guy 
who commented here at bottom of page 
https://httpd.apache.org/docs/2.4/vhosts/examples.html
To avoid this it seems necessary to add  Servername with an unexisting 
hostname. "ServerName non.existing_host.noTld"

Alltogether i think the 2.4 solution for defaulthosts is quite 
unfortunate. May be there should be used a really Default-Servername to 
mark defaulthost.
At least the docs should be updated and admins should be informed that 
they are "loosing" a usable servername and there is one fault probability.

Thanks,
Hajo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] unexpected behaviour of default host

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Dec 29, 2015 at 8:49 PM, Hajo Locke <Ha...@gmx.de> wrote:
>
>
> Am 29.12.2015 um 20:07 schrieb Eric Covener:
>>
>> On Tue, Dec 29, 2015 at 2:05 PM, Hajo Locke <Ha...@gmx.de> wrote:
>>>
>>> In Apache 2.2 we used additional "Servername *", but with 2.4 it is not
>>> allowed to use wildcards with Servername-Directive.
>>
>> I think it was treated as a literal * in 2.2. It's just a shorter/more
>> confusing version of non.existing_host.noTld.
>>
> Using a hostname which is already declared in same conf is not less
> confusing.

How about using an/the IP[:port] address?
That's how the default works actually, selecting the first VirtualHost
listening on the IP[:port] the connection comes from.
Since <VirtualHost *> may serve any request on any IP[:port], choose
any, or indeed "0.0.0.0".

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] unexpected behaviour of default host

Posted by Hajo Locke <Ha...@gmx.de>.

Am 29.12.2015 um 20:07 schrieb Eric Covener:
> On Tue, Dec 29, 2015 at 2:05 PM, Hajo Locke <Ha...@gmx.de> wrote:
>> In Apache 2.2 we used additional "Servername *", but with 2.4 it is not
>> allowed to use wildcards with Servername-Directive.
> I think it was treated as a literal * in 2.2. It's just a shorter/more
> confusing version of non.existing_host.noTld.
>
Using a hostname which is already declared in same conf is not less 
confusing.
Problem with shotcuts is that some people get lost in thicket.
May be cleanest way would be a directive "usethisaddefault true".
But as long the docs indicates to presented problem, iam satisfied.

Thanks,
Hajo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] unexpected behaviour of default host

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 29, 2015 at 2:05 PM, Hajo Locke <Ha...@gmx.de> wrote:
> In Apache 2.2 we used additional "Servername *", but with 2.4 it is not
> allowed to use wildcards with Servername-Directive.

I think it was treated as a literal * in 2.2. It's just a shorter/more
confusing version of non.existing_host.noTld.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org