LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   apache2.x : force timeout instead of 404 (https://www.linuxquestions.org/questions/linux-server-73/apache2-x-force-timeout-instead-of-404-a-485706/)

Nathanael 09-21-2006 01:15 PM

apache2.x : force timeout instead of 404
 
hey there,

simple thought - probably harder to implement - i guess...

i run a webserver which is setup with virtual hosts - using virtualDocumentRoot
say for example i have foo.example.com and fibble.example.com pointing to the address of my webserver,
apache will try
1. is there a virtualHost for this requested domain name
2. if not - can i find a matching directory in the virtualDocumentRoot

if step 2 should fail apache will of course respond with a 404 as in file not found

is there any way i could filter out 404's and force apache to ignore the request?
of even 'mark' the packets so i can get hold of them in iptables?
or force a client timeout some other way?

i am quite happy for this to be an iptables solution too...

Nathanael 09-25-2006 06:45 AM

i have found a solution (for all of thouse who are curious or whant to do similar):

as of kernel 2.6.14 i think it is (check on the netfilter website) the option -m string is available which will mach a string - in my case i need following command:

/sbin/iptables -A OUTPUT -m string --algo kmp --string "403 Forbidden" -j DROP

refer to the iptables man page for more info

edit: it is still a little unclean and i shall see if i can find something slightly better...


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