Re: Apache httpd does not respect the HTTP RFCs !

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux