1.0.0 • Published 9 years ago
refer-redir v1.0.0
refer-redir
Middleware for blocking requests based on referrer.
If any request contains a portain of a blocked referrer, the request will be blocked.
If a blocked referrer is encountered the response is ended. Currently, this will respond with a 200 code and an empty body.
npm install refer-redir
Options
filename
- name of file containing line separated urls to ignore
- NOTE: this is read synchronously
links
- array of urls to ignore
Examples
Reading from a file
var refer_redir = require("refer-redir");
app.use( refer_redir(".blocked") );
Providing an array of urls
var refer_redir = require("refer-redir");
app.use( refer_redir( ["darodar.com","sirspamalot.org"] ) );
Problems
This may not be the best way to go about this. But my blog is being hit with a ton of spam from certain referrers. So this is my quick fix.
Of course the spammers could just drop the referrer header and this is rendered useless...but it will do for now.