-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第 131 题:接口如何防刷 #254
Comments
|
把某个key加配料,带上时间戳,加密,请求时带上,过期或解密失败则403。 |
防刷一般分两种:
|
1:网关控制流量洪峰,对在一个时间段内出现流量异常,可以拒绝请求(参考个人博客文章 https://mp.csdn.net/postedit/81672222) |
前端埋点,判断是否用户行为 |
是否可以用参数签名? |
刷接口直接走脚本,前端限制有一定作用,但不大。
|
1、UA校验 |
前端可以使用节流的方式,添加时间戳等 |
前端如使用axios请求, 是有请求前拦截的, 把最近的一些请求地址加进数组, 请求前拦截器 判断一定时间内这个地址是否再出现 来控制请求频率 |
例如,公开的投票网站,,如何防止刷票,防止不了。真的没办法。 |
前端节流对防刷意义不大,刷接口肯定不是通过点页面的按钮这种方式来刷的。 |
1、校验请求头referer |
反爬虫 |
@impeiran 不限制频率还是没用啊 |
接口防刷,前端能做的很少吧。 |
刷是禁止不了的,只能提高刷的成本 前端:
后端:
|
后端 |
去了京东、腾讯、虾皮等厂子都问到了这个问题。
我们之前也遇到过,基本就是后端工程师限制用户的接口调用次数,面试官希望可以有更多的答案。
The text was updated successfully, but these errors were encountered: