diff options
author | Alexandre Flament <alex@al-f.net> | 2022-02-12 18:17:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 18:17:05 +0100 |
commit | a4942213a1dc6404616e239e0d2fb55a6e19a499 (patch) | |
tree | 9502ddf6a50c3cc49bd8f5fa4d44fca10ce7b522 | |
parent | 9cd9dfd26e07552419941a34369b084f2adc30f4 (diff) | |
parent | b99ccd7c02e0c325feeb06155ffc67a5e4ed887d (diff) | |
download | searxng-a4942213a1dc6404616e239e0d2fb55a6e19a499.tar.gz searxng-a4942213a1dc6404616e239e0d2fb55a6e19a499.zip |
Merge pull request #892 from dalf/limiter-update
plugin limiter: check only /image_proxy and /search
-rw-r--r-- | searx/plugins/limiter.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/searx/plugins/limiter.py b/searx/plugins/limiter.py index eb0704c9c..e028e3e4a 100644 --- a/searx/plugins/limiter.py +++ b/searx/plugins/limiter.py @@ -42,15 +42,15 @@ def is_accepted_request(inc_get_counter) -> bool: return False return True - c = inc_get_counter(interval=25, keys=[b'IP limit, all paths', x_forwarded_for]) - if c > 30: - return False + if request.path == '/search' and ('q' in request.args or 'q' in request.form): + c = inc_get_counter(interval=20, keys=[b'IP limit, burst', x_forwarded_for]) + if c > 30: + return False - c = inc_get_counter(interval=60, keys=[b'useragent limit, all paths', x_forwarded_for, user_agent]) - if c > 30: - return False + c = inc_get_counter(interval=600, keys=[b'IP limit, 10 minutes', x_forwarded_for]) + if c > 300: + return False - if request.path in ('/', '/search') and ('q' in request.args or 'q' in request.form): if re_bot.match(user_agent): return False |