Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Interesting Apache Virtual Host Issue
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
frameRATE
Guru
Guru


Joined: 28 Apr 2003
Posts: 386
Location: Orange County California

PostPosted: Wed Jan 07, 2009 1:40 am    Post subject: Interesting Apache Virtual Host Issue Reply with quote

So I just set my old gentoo server back up after a move across the country. A friend noticed that my virtual hosts weren't working after I upgraded my packages and he was right. I lost the config files! Oops. So I reset up my vhosts.d/ directory and found an interesting problem.

My main website is: www.framerate.info

My virtually hosted website: www.wrperformance.com

The former just loads a single "credits.png". The latter loads a logo, an address and a phone number.

If you load up the main site it works just fine. Loading the vhost site will load correct the first time, when you refresh it'll load the framerate.info (but from the virtual hosts's path! so the image will appear broken) and refreshing again will show it again correctly. This will continue every time you refresh the page.

Getting even stranger, you'll notice that this behavior happens in Internet Explorer 7/8. It happens in Google Chrome (both on windows). It DOES NOT happen on Safari (OSX) or Firefox3 (windows).

This made me think it was a caching problem, but watching access_log and error_log is *is* in fact requesting the wrong files from certain browsers, and not from others. I was under the impression that all the browsers sent the same HTTP request but I am apparently mistaken.

00_default_vhost.conf
Code:
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

# Use name-based virtual hosting.
NameVirtualHost *:80

# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
<VirtualHost *:80>
        ServerName framerate.info
        ServerAlias www.framerate.info framerate.info
        Include /etc/apache2/vhosts.d/default_vhost.include

        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>
</VirtualHost>
</IfDefine>

# vim: ts=4 filetype=apache


wr.conf
Code:
<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
        ServerName wrperformance
        ServerAlias www.wrperformance.com wrperformance.com
        Include /etc/apache2/vhosts.d/default_vhost.include
        DocumentRoot "/var/www/localhost/htdocs/_hosted/wrperformance"

        <IfModule mpm_peruser_module>
                ServerEnvironment apache apache
        </IfModule>
</VirtualHost>
</IfDefine>


Anything else I can provide to help figure this out.

Also to be noted, the server is behind a router that does port forwarding for port 80 straight to this box, but I do not suspect that it will have anything to do with this issue since the root framerate.info works just fine.

Thanks guys!
_________________

Linux User | 364705

howto install coldfusion mx 7 under gentoo
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Wed Jan 07, 2009 10:25 am    Post subject: Reply with quote

As far as I have understood ServerName should be equal to a real host name. It's no longer a simple name. It's used to determine the virtual host from the browser's query string. Use ServerAlias'es for additional host names.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
frameRATE
Guru
Guru


Joined: 28 Apr 2003
Posts: 386
Location: Orange County California

PostPosted: Wed Jan 07, 2009 5:55 pm    Post subject: Reply with quote

Updated to ".com" in wr.conf and same behavior.

I really can't figure out why it would switch which site to display when refreshed and ONLY on 2/4 browsers!

HALP!
_________________

Linux User | 364705

howto install coldfusion mx 7 under gentoo
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Thu Jan 08, 2009 8:38 am    Post subject: Reply with quote

I think it's probably because some browsers do resolve and qualify an unqualified hostname before they send the request. But I've just tried www.framerate.info and framerate.info in MSIE7 and the problem you described doesn't seem to happen. I don't have MSIE8 so it's all I can do ATM. BTW you didn't tell your version of Apache...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
frameRATE
Guru
Guru


Joined: 28 Apr 2003
Posts: 386
Location: Orange County California

PostPosted: Thu Jan 08, 2009 5:01 pm    Post subject: Reply with quote

VinzC wrote:
I think it's probably because some browsers do resolve and qualify an unqualified hostname before they send the request. But I've just tried www.framerate.info and framerate.info in MSIE7 and the problem you described doesn't seem to happen. I don't have MSIE8 so it's all I can do ATM. BTW you didn't tell your version of Apache...


framerate.info works fine... with or without www.

the problem is wrperformance.com (which is the first virtual host). framerate.info is the default site, it works fine. But wrperformance.com will load fine the first time, and then framerate.info will load when you refresh wrperformance.com, then alternate every refresh when loading wrperformance.com

My apache is whatever the latest version in portage is, it was updated 2 days ago.
_________________

Linux User | 364705

howto install coldfusion mx 7 under gentoo
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Fri Jan 09, 2009 1:10 pm    Post subject: Reply with quote

possible to do a packet capture?

vhost routing is contingent upon the presence of a "Host:" header IIRC

is it possible this isnt being sent? If so, be a bug in the browser. Not likely, but worth investigating.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum