|Do you know where your variables are?|
Send User To Oblivion!by carfac (Acolyte)
|on Mar 20, 2007 at 14:15 UTC||Need Help??|
carfac has asked for the wisdom of the Perl Monks concerning the following question:
Hi: I am a very novice user, so please pardon me if there is a very obvious solution I am missing!
I am writing an Apache Module, based on an existing script Apache::BlockIP. The existing script will block IP addresses (contained on a text file). Basically, you abuse my site, your IP gets written to this file, and Apache::BlockIP will block you from further activity.
What I am moding this to is called Apache::BlockRefer, and the purpose is to block log file spammers. Instead of an external text file of bad IPs, I keep an external list of common referrers spammers are using.
My problem comes at the end- The script will pass a 200, 302, 403 or whatever Apache server code. The thing about log spammers is you do not want to respond at all.
One option I have considered is to forward to my server on a port I have a sentry on, which will block the IP at the firewall, so there will be no further contact (and no write to the logs!) I set up a return REDIRECT, but that sends a 302 with the new URL, and that hits my logs. NOT a good solution.
Is there a way I can "silently" forward to "http://www.mysite.com:3550" in the manner of mod_rewrite- so the spammer is forwarded automatically with no 302? To me, this is the best solution as the IP is logged into my firewall, and all future attempts from the IP are ignored.
Alternatively, is there a way to just end the process with NO return to the user, or effectively black hole the request with NO reponse?
Once this little problem is solved, Apache::BlockRefer will be ready to go. I would be happy to share with anyone who wants a copy.