LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-12-2011, 05:57 PM   #16
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176

Quote:
Originally Posted by bathory View Post
This is exactly what happens for a HTTP/1.0 request. It points to the 1st vhost (as it's the default).
The "strange" thing I've noticed, is that I had to give a ServerName (default in this case), otherwise a request with Host: www.domain.com was pointing to the 1st vhost too. A request with Host: x.x.x.x point to the correct vhost.
This seems like what it does for you is allow a "Host: name" to match the first entry that has no ServerName or ServerAlias, whereas a "Host: address" does not. For me, the exact opposite is happening. You've been using * for the address and I've been using the IP address. Maybe that had an effect for what might well otherwise be "no definite behavior".

I'll add "ServerName default" on the first vhost and see what that does. Maybe that will prevent the "Host: address" case from matching it for me (I didn't have ServerName or ServerAlias at all).


Quote:
Originally Posted by bathory View Post
Maybe you have to take a look at hostmatching, or the use of ServerPath here

Regards
ServerPath is a workaround for getting HTTP/1.0 requests to go to vhosts by providing a path based mechanism to get there. That can have value in many cases. But that's not what I want to do. Instead, in the case of no "Host: anything" being given, I want to deliver a page directing the user to upgrade their browser. That, or deliver a page with some snide remark. Or maybe have it be a secret step to a hidden site. Whatever.

But I can see uses for ServerPath.
 
Old 10-13-2011, 12:53 AM   #17
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
You've been using * for the address and I've been using the IP address. Maybe that had an effect for what might well otherwise be "no definite behavior".
If I use NameVirtualHost 192.168.0.77:80, then I see the behavior you mentioned. A request with no "Host:" header points to the vhost with a ServerName 192.168.0.77.
If you are sure it was working in apache 1.x, you may file a bug report to apache and see what they'll answer to you.

Quote:
Instead, in the case of no "Host: anything" being given, I want to deliver a page directing the user to upgrade their browser. That, or deliver a page with some snide remark. Or maybe have it be a secret step to a hidden site. Whatever.
You can use mod_rewrite to redirect clients based on their browser "User-agent".

Regards
 
Old 10-13-2011, 09:14 AM   #18
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
The request with "Host: <IPaddr>" does NOT got to the vhost with "ServerName <IPaddr>" and instead goes to the first vhost for that IP address ... for me. The vhost with "ServerName <IPaddr>" is apparently unreachable if it is not the first vhost.

Since the description you give for your experience is nearly opposite, I have to conclude Apache has some sort of inconsistent behavior, either due to the differences in the rest of how we configure it, or in the different versions we are using (if any).

Both of our experiences seem not 100% consistent. One or the other case goes to the "wrong" vhost (though Apache developers may insist that it is right). I suspect the situation is the result of the fact that Apache's foundational core logic does not have any concept of virtual hosts, and that this is all an add on. IMHO, if they were to take the dynamic vhost logic they do have, and apply it to actually load host based config files on the fly (e.g. if the memory cached copy of the host config struct has an older date than the host specific config file, that config file is reloaded on the fly), and do all this as the core of a specifically host based server (anyone not wanting host named based would not use this one), they might actually have something that works more solidly and efficiently than the "patchy" mess they have now (but I guess that also means not using the same name).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide IPv6 address in URL. BernardLinux Linux - Newbie 3 09-26-2011 01:18 AM
URL to IP address cleopard Programming 5 03-28-2008 10:39 AM
Force using URL (ServerName) instead of IP address hapytran Linux - Server 2 12-06-2007 07:24 PM
Making Apache work Ab3n Linux - Newbie 3 04-03-2005 05:41 PM
anyone can decode this URL address? sirpelidor Linux - Software 8 02-21-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration