Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Alex Bligh



--On 30 May 2012 15:06:15 -0400 Eric Covener cove...@gmail.com wrote:


Is there anything else I can do, like (e.g.) put the IP address as
a hex constant or something in VirtualHost? Or disable this rather
annoying feature?


I'd suggest opening a bug report that something weird seems to happen
with the literal IP address in the virtualHost arguments and that it
works with *:80.


OK, that gives me an idea.

My config looks a bit like this:

# Listen on 192.200.0.1, 192.200.0.2, 192.200.0.3
Listen *:80
Listen *:1234 # --- config for this not omitted below

NameVirtualHost 192.200.0.1:80

VirtualHost 192.200.0.1:80  # --- *** THIS LINE ***
ServerName will-not-resolve.example.com:80 # port no included as per docs
# Default vhost for things that resolve to 192.200.0.1
/VirtualHost

VirtualHost 192.200.0.1:80
ServerName a.web.site.example.com:80 # port no included as per docs
# VHost for http://a.web.site.example.com/
/VirtualHost

VirtualHost 192.200.0.1:80
ServerName 192.200.0.1:80  # port no included as per docs
# VHost for http://192.200.0.1/
/VirtualHost

# 192.200.0.2
VirtualHost 192.200.0.2:80
 # IP based Virtual Host goes here on 192.200.0.2
/VirtualHost


To recap the problem is that accessing http://192.200.0.1/ returns the
default site (the first one), not the specific site (the third).

Suppose I change the line marked '*** THIS LINE *** so it reads
VirtualHost *:80  # --- *** THIS LINE ***

Will that interfere in any way with the IP based virtual host which is
the fourth above? I have no other name based virtual hosts and even if
I did, I wouldn't mind this being the global default. And will it fix
the issue that http://192.200.0.1/ is not connecting to the third
virtual host block above?



--
Alex Bligh

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Matus UHLAR - fantomas

On Wed, May 30, 2012 at 3:06 PM, Eric Covener cove...@gmail.com wrote:

Is there anything else I can do, like (e.g.) put the IP address as
a hex constant or something in VirtualHost? Or disable this rather
annoying feature?


I'd suggest opening a bug report that something weird seems to happen
with the literal IP address in the virtualHost arguments and that it
works with *:80.


On 30.05.12 22:10, Eric Covener wrote:

Sorry, just catching on now that Matus nailed it.  It's not so clear
what the code is trying to tolerate by comparing this way.


I guess that this was historic workaround for defining name-based 
virtual servers without defining ServerName/ServerAlias


VirtualHost one.na.me
# one.na.me served here
/VirtualHost

VirtualHost another.na.me
# another.na.me
/VirtualHost


Since this makes creating default-only name-based virtual hosts 
impossible, I've had to found the workaround mentioned in my previous 
mail.


I've been trying to solve this problem in the past, but I was only 
directed to the mentioned docs, I remember no explanation of why this 
is done.

--
Matus UHLAR - fantomas, uh...@fantomas.sk ; 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.
Micro$oft random number generator: 0, 0, 0, 4.33e+67, 0, 0, 0...

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Alex Bligh



--On 31 May 2012 08:34:42 +0100 Alex Bligh a...@alex.org.uk wrote:


To recap the problem is that accessing http://192.200.0.1/ returns the
default site (the first one), not the specific site (the third).

Suppose I change the line marked '*** THIS LINE *** so it reads
 VirtualHost *:80  # --- *** THIS LINE ***

Will that interfere in any way with the IP based virtual host which is
the fourth above? I have no other name based virtual hosts and even if
I did, I wouldn't mind this being the global default. And will it fix
the issue that http://192.200.0.1/ is not connecting to the third
virtual host block above?


This fails because VirtualHost *:80 does not appear to set
a default when you also have a VirtualHost 192.200.0.1:80. The
latter always becomes the default.

--
Alex Bligh

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Eric Covener
 # Listen on 192.200.0.1, 192.200.0.2, 192.200.0.3
 Listen *:80
 Listen *:1234 # --- config for this not omitted below

 NameVirtualHost 192.200.0.1:80

 VirtualHost 192.200.0.1:80  # --- *** THIS LINE ***
 ServerName will-not-resolve.example.com:80 # port no included as per docs
 # Default vhost for things that resolve to 192.200.0.1
 /VirtualHost

 VirtualHost 192.200.0.1:80
 ServerName a.web.site.example.com:80 # port no included as per docs
 # VHost for http://a.web.site.example.com/
 /VirtualHost

 VirtualHost 192.200.0.1:80
 ServerName 192.200.0.1:80  # port no included as per docs
 # VHost for http://192.200.0.1/
 /VirtualHost

 # 192.200.0.2
 VirtualHost 192.200.0.2:80
  # IP based Virtual Host goes here on 192.200.0.2
 /VirtualHost

This config can avoid the problematic behavior by s/VirtualHost
192.200.0.1:80/VirtualHost *:80 and letting normal name-based
resolution take over for everything other than 192.200.0.2.

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Eric Covener
 This fails because VirtualHost *:80 does not appear to set
 a default when you also have a VirtualHost 192.200.0.1:80. The
 latter always becomes the default.

This is sensible/expected, the vhosts with a specific match in the
incoming interface are the only candidates.

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Alex Bligh



--On 31 May 2012 07:02:57 -0400 Eric Covener cove...@gmail.com wrote:


This fails because VirtualHost *:80 does not appear to set
a default when you also have a VirtualHost 192.200.0.1:80. The
latter always becomes the default.


This is sensible/expected, the vhosts with a specific match in the
incoming interface are the only candidates.


OK. So is there any way, in an environment where it is not possible
to create DNS entries to order, where namevirtualhosts are used,
to have a default vhost which is different from a vhost whose name
is the IP address?

--
Alex Bligh

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-31 Thread Matus UHLAR - fantomas

--On 31 May 2012 07:02:57 -0400 Eric Covener cove...@gmail.com wrote:


This fails because VirtualHost *:80 does not appear to set
a default when you also have a VirtualHost 192.200.0.1:80. The
latter always becomes the default.


This is sensible/expected, the vhosts with a specific match in the
incoming interface are the only candidates.


On 31.05.12 12:36, Alex Bligh wrote:

OK. So is there any way, in an environment where it is not possible
to create DNS entries to order, where namevirtualhosts are used,
to have a default vhost which is different from a vhost whose name
is the IP address?


btw: we use hostnames that are present in /etc/hosts.

I found it more efficient to create different /etc/hosts (same name, 
different IP) on multiple machines than push httpd.conf through a 
filter that will replace hostname by IP.


Just for sure: * is not acceptable (yet)
--
Matus UHLAR - fantomas, uh...@fantomas.sk ; 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.
Where do you want to go to die? [Microsoft]

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-30 Thread Matus UHLAR - fantomas
--On 29 May 2012 16:02:25 +0200 Matus UHLAR - fantomas 
uh...@fantomas.sk wrote:



This was documented feature in 1.3 and 2.0:

The complete list of names in the VirtualHost  directive are treated just
like a ServerAlias (but are not overridden by any ServerAlias statement)
if all names resolve to the same address set. Note that subsequent Listen
statements for this vhost will not affect the ports assigned in the
address set.

It seems that in 2.2 it should work as you expect. Do you still use 2.0
or does this problem apply in 2.2 too?
(I've checked now and seems it's gone in 2.2)


On 29.05.12 16:40, Alex Bligh wrote:

I am using 2.2 (latest from Ubuntu Lucid).



I am not sure how to parse your second paragraph. There is only one
Listen statement as this is a NameVirtualHost (in this case a Listen
for *:80). NameVirtualHost is on 192.200.0.1:80 because there are
non-namebased virtual hosts on other IP addresses.


it's not mine, but from apache 1.3/2.0 docs. 


I think what you are saying is that in 1.3 and 2.0 the first declared
virtual host not only acts as the default virtual host but also as if
it had an alias defined for the IP address/port pair it is listening
on.


Not the on it's listening on, but the one in VirtualHost section.
It means than for

VirtualHost some.na.me

the some.na.me becomes a hidden alias of the virtualhost.
So, when you define

VirtualHost 192.168.0.1
/VirtualHost
VirtualHost 192.168.0.1
ServerName 192.168.0.1
/VirtualHost

the second won't apply for 192.168.0.1, because 192.168.0.1 is already 
alias (hidden) of the first (default) virtual host.



My understanding from the documentation is that this is not the
intended behaviour on 2.2 - i.e. each vhost should be responding only
for its defined ServerAlias and ServerName, and if none match the
default should be used. That does not /appear/ to be happening, so perhaps
the behaviour has not changed from the 1.3/2.0 behaviour you describe.

Is that meant to be the case?

If so, is there any way around this? (i.e. so an arbitrary DNS name pointing
to the IP address will get the default vhost, but the IP address itself
will get a different vhost).


I worked around this problem by defining fake name in NameVirtualHost 
and VirtualHost sections


# some.na.me maps to 192.168.0.1
NameVirtualHost some.na.me
NameVirtualHost 192.168.0.1

# some.na.me is not resolvable from outside, so this host will ONLY get 
# default hosts - unspecified below

VirtualHost some.na.me
ServerName some.na.me
/VirtualHost

# This host will only process requests for 192.168.0.1
VirtualHost 192.168.0.1
ServerName 192.168.0.1
/VirtualHost

--
Matus UHLAR - fantomas, uh...@fantomas.sk ; 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.
Microsoft dick is soft to do no harm

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-30 Thread Alex Bligh



--On 30 May 2012 14:41:53 +0200 Matus UHLAR - fantomas uh...@fantomas.sk 
wrote:



I worked around this problem by defining fake name in NameVirtualHost and
VirtualHost sections

# some.na.me maps to 192.168.0.1
NameVirtualHost some.na.me
NameVirtualHost 192.168.0.1

# some.na.me is not resolvable from outside, so this host will ONLY get #
# default hosts - unspecified below
VirtualHost some.na.me
ServerName some.na.me
/VirtualHost

# This host will only process requests for 192.168.0.1
VirtualHost 192.168.0.1
ServerName 192.168.0.1
/VirtualHost


OK, so it is the VirtualHost some.na.me that is fixing this (really) not
the ServerName some.na.me line. I'm already doing the latter:
ServerName default.example.com

My problem is this is an automated install system and (broadly speaking)
I have no control over DNS.

Is there anything else I can do, like (e.g.) put the IP address as
a hex constant or something in VirtualHost? Or disable this rather
annoying feature?

--
Alex Bligh

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-30 Thread Eric Covener
 Is there anything else I can do, like (e.g.) put the IP address as
 a hex constant or something in VirtualHost? Or disable this rather
 annoying feature?

I'd suggest opening a bug report that something weird seems to happen
with the literal IP address in the virtualHost arguments and that it
works with *:80.

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-30 Thread Eric Covener
On Wed, May 30, 2012 at 3:06 PM, Eric Covener cove...@gmail.com wrote:
 Is there anything else I can do, like (e.g.) put the IP address as
 a hex constant or something in VirtualHost? Or disable this rather
 annoying feature?

 I'd suggest opening a bug report that something weird seems to happen
 with the literal IP address in the virtualHost arguments and that it
 works with *:80.


Sorry, just catching on now that Matus nailed it.  It's not so clear
what the code is trying to tolerate by comparing this way.

-- 
Eric Covener
cove...@gmail.com

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-30 Thread Eric Covener
On Wed, May 30, 2012 at 10:10 PM, Eric Covener cove...@gmail.com wrote:
 On Wed, May 30, 2012 at 3:06 PM, Eric Covener cove...@gmail.com wrote:
 Is there anything else I can do, like (e.g.) put the IP address as
 a hex constant or something in VirtualHost? Or disable this rather
 annoying feature?

 I'd suggest opening a bug report that something weird seems to happen
 with the literal IP address in the virtualHost arguments and that it
 works with *:80.


 Sorry, just catching on now that Matus nailed it.  It's not so clear
 what the code is trying to tolerate by comparing this way.

docs bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=53334

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-29 Thread Matus UHLAR - fantomas

On 24.05.12 20:13, Alex Bligh wrote:

If I use an IP address as the name of the second site like this:

NameVirtualHost 192.200.0.1:80
VirtualHost 192.200.0.1:80
  ServerName default.example.com
... stuff ...
/VirtualHost
VirtualHost 192.200.0.1:80
  ServerName 192.200.0.1
... stuff ...
/VirtualHost

the I would expect http://192.200.0.1/ to return the second site, not
the default site. However, it seems to return the default.

Is this a bug, and is there any work around? (I want the default site
to be there still).


This was documented feature in 1.3 and 2.0:

The complete list of names in the VirtualHost  directive are treated 
just like a ServerAlias (but are not overridden by any ServerAlias 
statement) if all names resolve to the same address set. Note that 
subsequent Listen statements for this vhost will not affect the ports 
assigned in the address set.


It seems that in 2.2 it should work as you expect. Do you still use 2.0 
or does this problem apply in 2.2 too?

(I've checked now and seems it's gone in 2.2)
--
Matus UHLAR - fantomas, uh...@fantomas.sk ; 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.
The 3 biggets disasters: Hiroshima 45, Tschernobyl 86, Windows 95

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



Re: [users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-29 Thread Alex Bligh



--On 29 May 2012 16:02:25 +0200 Matus UHLAR - fantomas uh...@fantomas.sk 
wrote:



This was documented feature in 1.3 and 2.0:

The complete list of names in the VirtualHost  directive are treated just
like a ServerAlias (but are not overridden by any ServerAlias statement)
if all names resolve to the same address set. Note that subsequent Listen
statements for this vhost will not affect the ports assigned in the
address set.

It seems that in 2.2 it should work as you expect. Do you still use 2.0
or does this problem apply in 2.2 too?
(I've checked now and seems it's gone in 2.2)


I am using 2.2 (latest from Ubuntu Lucid).

I am not using ServerAlias.

I am not sure how to parse your second paragraph. There is only one
Listen statement as this is a NameVirtualHost (in this case a Listen
for *:80). NameVirtualHost is on 192.200.0.1:80 because there are
non-namebased virtual hosts on other IP addresses.

I think what you are saying is that in 1.3 and 2.0 the first declared
virtual host not only acts as the default virtual host but also as if
it had an alias defined for the IP address/port pair it is listening
on. My understanding from the documentation is that this is not the
intended behaviour on 2.2 - i.e. each vhost should be responding only
for its defined ServerAlias and ServerName, and if none match the
default should be used. That does not /appear/ to be happening, so perhaps
the behaviour has not changed from the 1.3/2.0 behaviour you describe.

Is that meant to be the case?

If so, is there any way around this? (i.e. so an arbitrary DNS name pointing
to the IP address will get the default vhost, but the IP address itself
will get a different vhost).

--
Alex Bligh

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



[users@httpd] Should name based virtual hosts work when the ServerName is an IP address?

2012-05-24 Thread Alex Bligh

If I have a configuration like this:

NameVirtualHost 192.200.0.1:80
VirtualHost 192.200.0.1:80
   ServerName default.example.com
... stuff ...
/VirtualHost
VirtualHost 192.200.0.1:80
   ServerName a.example.com
... stuff ...
/VirtualHost

then http://a.example.com/ will return the second site (correctly), not the
default site.

If I use an IP address as the name of the second site like this:

NameVirtualHost 192.200.0.1:80
VirtualHost 192.200.0.1:80
   ServerName default.example.com
... stuff ...
/VirtualHost
VirtualHost 192.200.0.1:80
   ServerName 192.200.0.1
... stuff ...
/VirtualHost

the I would expect http://192.200.0.1/ to return the second site, not
the default site. However, it seems to return the default.

Is this a bug, and is there any work around? (I want the default site
to be there still).

--
Alex Bligh

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