You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Christopher J. Bottaro" <cj...@alumni.cs.utexas.edu> on 2005/01/08 08:08:45 UTC

[users@httpd] Re: Blocking http requests to certain URLs.

Dick Davies wrote:

> * Aman Raheja <ar...@techquotes.com> [0148 02:48]:
>> It sure means you are listening on * and ServerName directive not setup
>> Be specific and use the Listen directive wisely, like
>> Listen xxx.xxx.xxx.xxx:80
>> and use the same on your VirtualHost, if you have one and ServerName
>> directive be
>> ServerName www.mydomain.com
>> Then only www.mydomain.com will respond.
> 
> No, I don't think that's right. There's always a default vhost, if you
> only have one then all requests to port 80 end up there regardless of
> what the Host: header (domain name the browser asked for) is.
> If you don't define a vhost at all (which I guess is the case here) then
> all requests end up at the DocumentRoot, whether you get there by name
> or the IP.

Yes, this sounds like what is happening.

> Christopher, what do you want to happen when someone goes to those
> domains?

Hmm, I guess I would like the standard "Not Found" page to be displayed.

> Probably easiest to put something in the default DocumentRoot (up 
> in 'Section 2' of httpd.conf) which asks people to use the correct name or
> whatever, and then create a virtual host for www.mydomain.net.

Sounds like a plan:  make all domains give the "Not Found" page, except for
www.mydomain.net by making a virtual host for it.  Ok, I think I can figure
out the virtual host thing by reading the manual, but how about that "Not
Found" page thing?

> ( I'm sure someone will recommend doing something with mod_rewrite too,
> but I tend to think that's overly complex. If you're going to rewrite to
> somewhere anyway, you may as well just have the vhost system do that for
> you.
>
> To misquote Jamie Zawinski:
> 
> 'Some people, when confronted with a problem, think:
> "I know, I'll use mod_rewrite".
> Now they have two problems.'
> )

Hehe, I'll keep that in mind...thanks for the help.


---------------------------------------------------------------------
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] Re: Blocking http requests to certain URLs.

Posted by Dick Davies <ra...@hellooperator.net>.
* Christopher J. Bottaro <cj...@alumni.cs.utexas.edu> [0107 07:07]:
> > Christopher, what do you want to happen when someone goes to those
> > domains?
> 
> Hmm, I guess I would like the standard "Not Found" page to be displayed.
> 
> > Probably easiest to put something in the default DocumentRoot (up 
> > in 'Section 2' of httpd.conf) which asks people to use the correct name or
> > whatever, and then create a virtual host for www.mydomain.net.
> 
> Sounds like a plan:  make all domains give the "Not Found" page, except for
> www.mydomain.net by making a virtual host for it.  Ok, I think I can figure
> out the virtual host thing by reading the manual, but how about that "Not
> Found" page thing?

Following the 'do the simplest thing that could possibly work' philosophy,
just plonk an index.html into that default docroot. 
It could have a list of the vhosts that exist or similar, perhaps?

This is then effectively your default vhost, where everything goes by 
default. When you add a new <VirtualHost> entry, then requests for that
ServerName will end up there.
 
-- 
'This must be Thursday. I never could get the hang of Thursdays.'
		-- Arthur Dent
Rasputin :: Jack of All Trades - Master of Nuns

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