mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 01:36:29 +00:00
Merge pull request #892 from dalf/limiter-update
plugin limiter: check only /image_proxy and /search
This commit is contained in:
commit
a4942213a1
1 changed files with 7 additions and 7 deletions
|
@ -42,15 +42,15 @@ def is_accepted_request(inc_get_counter) -> bool:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
c = inc_get_counter(interval=25, keys=[b'IP limit, all paths', x_forwarded_for])
|
if request.path == '/search' and ('q' in request.args or 'q' in request.form):
|
||||||
if c > 30:
|
c = inc_get_counter(interval=20, keys=[b'IP limit, burst', x_forwarded_for])
|
||||||
return False
|
if c > 30:
|
||||||
|
return False
|
||||||
|
|
||||||
c = inc_get_counter(interval=60, keys=[b'useragent limit, all paths', x_forwarded_for, user_agent])
|
c = inc_get_counter(interval=600, keys=[b'IP limit, 10 minutes', x_forwarded_for])
|
||||||
if c > 30:
|
if c > 300:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if request.path in ('/', '/search') and ('q' in request.args or 'q' in request.form):
|
|
||||||
if re_bot.match(user_agent):
|
if re_bot.match(user_agent):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue