开发者

Restrict node with CAPTCHA

i开发者_Python百科s there any quick solution to restrict access to one node (page) with a captcha module (or some other, similar way)?


If you mean to allow a user to access a node if he passes a CAPTCHA, then there isn't any module for that.
If I understood what you mean, the module should present a CAPTCHA, and if the answer is correct, then the node should be shown. You can create a custom module using the CAPTCHA module.


If your purpose is to block bots, try these:

  • ddos
  • botbouncer

I have used "ddos" earlier just to block too many requests from an IP on a previous website. The usage is fairly simple: -

In your app.js, add

var Ddos = require('ddos')
var ddos = new Ddos({burst:10, limit:50,errormessage:'Maximum number of 
requests exceeded from your system, please wait to regain access'})

app.use(ddos.express);

So, how ddos works is it maintains an internal count of the number of requests it receives from each IP. For every request it receives, it increments the counter. And for every second that passes without a request, the previous entries are deleted.

Now, if for a certain IP, the limit (here, 50) is exceeded, 429 error is thrown. From here on in, every subsequent request increments at the specified burst rate (here, 10) until the internal counter resets.

This is the next best thing to incorporating Cloudflare on your website. Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜