httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Wiedmann <carsten_st...@gmx.de>
Subject [users@httpd] Re: Apache httpd does not respect the HTTP RFCs !
Date Sun, 29 Nov 2009 00:23:12 GMT
André Warnier schrieb:
> So how do you enumerate invalid hosts explicitly then ?

Right, it's a little bit curious, that you can't set 400 with mod_rewrite
(or header), only 403 (or 410).

That's what I'm always doing:

httpd-vhosts.conf:

| NameVirtualHost *:80
|
| <VirtualHost *:80>
|     ServerName nohost
|     RewriteEngine On
|     RewriteRule ^.*$ /cgi-bin/nohost.pl [PT,NS]
| </VirtualHost>
|
| <VirtualHost *:80>
|     ServerName host1.example.com
|     # other directives
| </VirtualHost>
|
| <VirtualHost *:80>
|     ServerName host2.example.com
|     # other directives
| </VirtualHost>
|
| # other vhosts


nohost.pl:

| #!/usr/bin/perl
|
| print "Status: 400 Bad Request\n";
| print "Content-type: text/html; charset=iso-8859-1\n\n";
|
| print "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n";
| print "<html>\n";
| print "<head>\n";
| print "<title>400 Bad Request</title>\n";
| print "</head>\n";
| print "<body>\n";
| print "<h1>Bad Request</h1>\n";
| print "<p>\n";
| print "Your browser sent a request that\n";
| print "this server could not understand.<br />\n";
| print "</p>\n";
| print "<hr>\n";
| print $ENV{"SERVER_SIGNATURE"};
| print "</body>\n";
| print "</html>\n";

Regards,
Carsten



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


Mime
View raw message