You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chirouze Olivier <ol...@volvo.com> on 2010/01/13 15:39:56 UTC

[users@httpd] Name based virtual host bug after Apache restart

Hi,

After some years out of the Apache discussion, I'm back for a quite specific question... ;-)

We have been running Apache HTTP Server 2.0 for some years now. Everything works fine as expected but I think we encounter something that can only be a bug.

We are using _name based virtual hosts_ and mod_rewrite. Each virtual host is defined in a specific conf file that is included by httpd.conf

Let's say:

FileA:
<VirtualHost ip:port>
ServerName nameA1.org
ServerAlias nameA2.org
[...]
</VirtualHost>

FileB:
<VirtualHost ip:port>
ServerName nameB1.org
ServerAlias nameB2.org
[...]
</VirtualHost>

(yes, I'm talking about same ip:port)

One day nameB1.org started not to work properly: requests to, say http://nameB1.org/  didn't go to FileB, but were treated by httpd.conf. We could see that in log files. A simple restart and the problem was fixed. A few weeks later, the problem reoccured and we realized it happend just after a restart we had done (without changing FileB at all).

Today we realized we had the problem again: I double checked logs and saw it started after a restart I made. I tested that requests to nameB2.org worked, _not_ nameB1.org: they were treated by httpd.conf and ended as "forbidden" (because of course the proper Rewrite rules are in the appropriate virtualhost).

In a word: _sometimes_ when we restart Apache, one of our many servernames/aliases doesn't go to the proper virtualhost, it is treated by httpd.conf.

Answers to some questions you might ask:
- we are running 2.0.58
- This is _always the same servername_ that fails.
- the actual servername that bugs is of the form www.aservername.co.za<http://www.aservername.co.za/> (something with the double country extension?? - we do have other servers of the form .co.uk, co.il, etc and they work as expected)
- I checked that the servername appears only in the proper virtual host
- I verified that DNS resolution stayed correct: the IP is always the one from the correct virtualhost, it SHOULD work.
- note that a serveralias in the same virtualhost still works: in fact, it's ServerName www.something.com<http://www.something.com> and ServerAlias something.com. something.com goes to the correct virtualhost, www.something.com<http://www.something.com> doesn't.
- originaly the servername was one of many serveraliases in a virtualhost. We extracted it to a separate virtualhost and conf file but the problem still occurs.

Any idea???

Thanks!

Olivier

RE: [users@httpd] Name based virtual host bug after Apache restart

Posted by Chirouze Olivier <ol...@volvo.com>.
Of course, I should have guessed about the command just statically parsing files. However, at least I'd have a live proof that it's a bug if I run the command while the server behaves strange :-)

Sorry, what do you mean about duplicate? Would you mean:

<VirtualHost ip:port>
ServerName nameB1.org
ServerAlias nameB1.org
ServerAlias nameB2.org
[...]
</VirtualHost>

OR

<VirtualHost ip:port>
ServerName nameB2.org
ServerAlias nameB1.org
[...]
</VirtualHost>

?

By the way, I should have specified that we have a QA server with exact same configuration and off course, we can't reproduce the bug ;-)

Regarding Rewrite rules, we have plenty of them: the Apache I'm talking about is a reverse proxy. But I'm pretty sure I would server a hello_world.html it would be the same...

Olivier

> -----Original Message-----
> From: Eric Covener [mailto:covener@gmail.com] 
> Sent: 13 January 2010 16:17
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Name based virtual host bug after 
> Apache restart
> 
> > - the actual servername that bugs is of the form
> > www.aservername.co.za (something with the double country 
> extension?? - we do
> > have other servers of the form .co.uk, co.il, etc and they 
> work as expected)
> 
> > - note that a serveralias in the same virtualhost still 
> works: in fact, it's
> > ServerName www.something.com and ServerAlias something.com. 
> something.com
> > goes to the correct virtualhost, www.something.com doesn't.
> 
> For relief, could you just duplicate the ServerName into the 
> ServerAlias?
> 
> What rewrite stuff do you have that might care about incoming
> hostnames or the servername?
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> 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
> 
> 
---------------------------------------------------------------------
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


Re: [users@httpd] Name based virtual host bug after Apache restart

Posted by Eric Covener <co...@gmail.com>.
> - the actual servername that bugs is of the form
> www.aservername.co.za (something with the double country extension?? - we do
> have other servers of the form .co.uk, co.il, etc and they work as expected)

> - note that a serveralias in the same virtualhost still works: in fact, it's
> ServerName www.something.com and ServerAlias something.com. something.com
> goes to the correct virtualhost, www.something.com doesn't.

For relief, could you just duplicate the ServerName into the ServerAlias?

What rewrite stuff do you have that might care about incoming
hostnames or the servername?

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


Re: [users@httpd] Name based virtual host bug after Apache restart

Posted by Eric Covener <co...@gmail.com>.
On Wed, Jan 13, 2010 at 10:00 AM, Chirouze Olivier
<ol...@volvo.com> wrote:
> Hi Tom, thanks for the so prompt answer!
>
> I didn't know that option of httpd, looks interesting.
> As of today, the vhost goes to the appropriate file (according to the DUMP VHOST). But I would use that same command when it fails again (after next reboot? ;-)

that command doesn't query the running server, it just parses the
config file, so you won't see it change when you hit your alleged bug.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


RE: [users@httpd] Name based virtual host bug after Apache restart

Posted by Chirouze Olivier <ol...@volvo.com>.
Hi Tom, thanks for the so prompt answer!

I didn't know that option of httpd, looks interesting.
As of today, the vhost goes to the appropriate file (according to the DUMP VHOST). But I would use that same command when it fails again (after next reboot? ;-)

To answer your question, we are listening on different IPs and that is why we need to specify it in the vhost config.

Olivier
 

> -----Original Message-----
> From: Tom Evans [mailto:tevans.uk@googlemail.com] 
> Sent: 13 January 2010 15:47
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Name based virtual host bug after 
> Apache restart
> 
> On Wed, Jan 13, 2010 at 2:39 PM, Chirouze Olivier
> <ol...@volvo.com> wrote:
> > Hi,
> >
> > After some years out of the Apache discussion, I'm back for 
> a quite specific
> > question... ;-)
> >
> > We have been running Apache HTTP Server 2.0 for some years 
> now. Everything
> > works fine as expected but I think we encounter something 
> that can only be a
> > bug.
> >
> > We are using _name based virtual hosts_ and mod_rewrite. 
> Each virtual host
> > is defined in a specific conf file that is included by httpd.conf
> >
> > Let's say:
> >
> > FileA:
> > <VirtualHost ip:port>
> > ServerName nameA1.org
> > ServerAlias nameA2.org
> > [...]
> > </VirtualHost>
> >
> > FileB:
> > <VirtualHost ip:port>
> > ServerName nameB1.org
> > ServerAlias nameB2.org
> > [...]
> > </VirtualHost>
> >
> > (yes, I'm talking about same ip:port)
> >
> > One day nameB1.org started not to work properly: requests to,
> > say http://nameB1.org/  didn't go to FileB, but were 
> treated by httpd.conf.
> > We could see that in log files. A simple restart and the 
> problem was fixed.
> > A few weeks later, the problem reoccured and we realized it 
> happend just
> > after a restart we had done (without changing FileB at all).
> >
> > Today we realized we had the problem again: I double 
> checked logs and saw it
> > started after a restart I made. I tested that requests to 
> nameB2.org worked,
> > _not_ nameB1.org: they were treated by httpd.conf and ended 
> as "forbidden"
> > (because of course the proper Rewrite rules are in the appropriate
> > virtualhost).
> >
> > In a word: _sometimes_ when we restart Apache, one of our many
> > servernames/aliases doesn't go to the proper virtualhost, 
> it is treated by
> > httpd.conf.
> >
> > Answers to some questions you might ask:
> > - we are running 2.0.58
> > - This is _always the same servername_ that fails.
> > - the actual servername that bugs is of the form
> > www.aservername.co.za (something with the double country 
> extension?? - we do
> > have other servers of the form .co.uk, co.il, etc and they 
> work as expected)
> > - I checked that the servername appears only in the proper 
> virtual host
> > - I verified that DNS resolution stayed correct: the IP is 
> always the one
> > from the correct virtualhost, it SHOULD work.
> > - note that a serveralias in the same virtualhost still 
> works: in fact, it's
> > ServerName www.something.com and ServerAlias something.com. 
> something.com
> > goes to the correct virtualhost, www.something.com doesn't.
> > - originaly the servername was one of many serveraliases in 
> a virtualhost.
> > We extracted it to a separate virtualhost and conf file but 
> the problem
> > still occurs.
> >
> > Any idea???
> >
> > Thanks!
> >
> > Olivier
> 
> What does ``httpd -S -f /path/to/conf'' say about this vhost?
> 
> Is the vhost that it ends up going to the default vhost? Ie the first
> encountered when parsing the conf file.
> This would indicate that the requested hostname didn't match any other
> applicable vhost.
> 
> The one weird thing in your config is that you are specifying an
> ip:port for your vhosts. Are you using _solely_ name based virtual
> hosting? If so, I would configure the vhosts with ``<VirtualHost
> *:80>'' (and obviously, ``NameVirtualHost *:80'' in the appropriate
> place) rather than a specific ip:port.
> 
> Cheers
> 
> Tom
> 
> ---------------------------------------------------------------------
> 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
> 
> 
---------------------------------------------------------------------
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


Re: [users@httpd] Name based virtual host bug after Apache restart

Posted by Tom Evans <te...@googlemail.com>.
On Wed, Jan 13, 2010 at 2:39 PM, Chirouze Olivier
<ol...@volvo.com> wrote:
> Hi,
>
> After some years out of the Apache discussion, I'm back for a quite specific
> question... ;-)
>
> We have been running Apache HTTP Server 2.0 for some years now. Everything
> works fine as expected but I think we encounter something that can only be a
> bug.
>
> We are using _name based virtual hosts_ and mod_rewrite. Each virtual host
> is defined in a specific conf file that is included by httpd.conf
>
> Let's say:
>
> FileA:
> <VirtualHost ip:port>
> ServerName nameA1.org
> ServerAlias nameA2.org
> [...]
> </VirtualHost>
>
> FileB:
> <VirtualHost ip:port>
> ServerName nameB1.org
> ServerAlias nameB2.org
> [...]
> </VirtualHost>
>
> (yes, I'm talking about same ip:port)
>
> One day nameB1.org started not to work properly: requests to,
> say http://nameB1.org/  didn't go to FileB, but were treated by httpd.conf.
> We could see that in log files. A simple restart and the problem was fixed.
> A few weeks later, the problem reoccured and we realized it happend just
> after a restart we had done (without changing FileB at all).
>
> Today we realized we had the problem again: I double checked logs and saw it
> started after a restart I made. I tested that requests to nameB2.org worked,
> _not_ nameB1.org: they were treated by httpd.conf and ended as "forbidden"
> (because of course the proper Rewrite rules are in the appropriate
> virtualhost).
>
> In a word: _sometimes_ when we restart Apache, one of our many
> servernames/aliases doesn't go to the proper virtualhost, it is treated by
> httpd.conf.
>
> Answers to some questions you might ask:
> - we are running 2.0.58
> - This is _always the same servername_ that fails.
> - the actual servername that bugs is of the form
> www.aservername.co.za (something with the double country extension?? - we do
> have other servers of the form .co.uk, co.il, etc and they work as expected)
> - I checked that the servername appears only in the proper virtual host
> - I verified that DNS resolution stayed correct: the IP is always the one
> from the correct virtualhost, it SHOULD work.
> - note that a serveralias in the same virtualhost still works: in fact, it's
> ServerName www.something.com and ServerAlias something.com. something.com
> goes to the correct virtualhost, www.something.com doesn't.
> - originaly the servername was one of many serveraliases in a virtualhost.
> We extracted it to a separate virtualhost and conf file but the problem
> still occurs.
>
> Any idea???
>
> Thanks!
>
> Olivier

What does ``httpd -S -f /path/to/conf'' say about this vhost?

Is the vhost that it ends up going to the default vhost? Ie the first
encountered when parsing the conf file.
This would indicate that the requested hostname didn't match any other
applicable vhost.

The one weird thing in your config is that you are specifying an
ip:port for your vhosts. Are you using _solely_ name based virtual
hosting? If so, I would configure the vhosts with ``<VirtualHost
*:80>'' (and obviously, ``NameVirtualHost *:80'' in the appropriate
place) rather than a specific ip:port.

Cheers

Tom

---------------------------------------------------------------------
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