*From memory, so check it*
I believe the default VirtualHost behavior is to serve any
NamedVirtualHost that isn't actually found from the first VirtualHost
section declared. So for example, if you had...
<VirtualHost *:80>
ServerName bob.yourdomain.com
...
</VirtualHost>
<VirtualHost *:80>
ServerName jim.yourdomain.com
...
</VirtualHost>
...and you asked for / from thelma.yourdomain.com (which, for this
argument, has valid DNS entries pointing at the same server, but no
VirtualHost mentioning it), you'd be served documents as if you'd asked
for / from bob.yourdomain.com.
To get the behavior you described (at the expense of losing any
/desired/ default host function), you could define all your valid
virtual hosts, then create another virtual host which would come first
in httpd.conf such as:
<VirtualHost *:80>
# No ServerName needed
DocumentRoot /some/empty/place/to/produce/404s
ErrorDocument 404 /path/to/custom/404/if/desired.html
</VirtualHost>
...or something. Again, this is all from memory without looking at any
docs or examples at the moment, and my memory has been known to do
strange things in the past. Someone may have a much better suggestion
than this, as well.
~B
Tarus Balog wrote:
Gang:
We're working on a new HTTP poller for OpenNMS that does things like
handle virtual domains, user agents, etc. Just wanted to know if anyone
could shed light on the following behavior.
If I
telnet opennms.org 80
and send the following strings:
GET / HTTP/1.1
Host: zztop.canes.com
Connection: Close
I get a 302 Found response. The Host is just made up, so I would expect
a 400 or 500 level error.
If I do the same for another server:
telnet internal.opennms.com 80
GET / HTTP/1.1
Host: zztop.canes.com
Connection: Close
I get a 200 response with the default page.
Since I get different responses, I assume that I have configured apache
differently on each server. My questions:
1) What *should* be the response? Is there an RFC or standard that
dictates it?
2) How would I configure it for a 404, etc.
-T
-----
Tarus Balog
The OpenNMS Group, Inc.
Main : +1 919 545 2553 Fax: +1 503-961-7746
Direct: +1 919 647 4749 Skype: tarusb
Key Fingerprint: 8945 8521 9771 FEC9 5481 512B FECA 11D2 FD82 B45C
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc