How to prevent code/program access to web application?

后端 未结 1 1487
猫巷女王i
猫巷女王i 2021-01-22 14:47

I would like prevent anyone trying to access my website thro\' code. Code in the sense, any program that is like bot, which would cause traffic surge.

For instance,

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-22 15:16

    Short answer is you can't. However, you can make some checks like user agent (but again, this is easily changed/spoofed).

    But let's say you want to get the majority, check that the User Agent is acceptable, check the device for mobile devices accessing you page.

    Another method I know that people have done is track the number of requests a source is making and having a threshold of request / time to test if the connection is "legit". I haven't done this myself, so I can't speak to it's reliability.

    If you want to distinguish between robots, tools like ( ReCaptcha) will help.

    0 讨论(0)
提交回复
热议问题