Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

Thanks!

Dave

In reply to Send User To Oblivion! by carfac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found