Browse Source

[fix] sec-fetch-* headers cannot be verified for non-secure requests (#4962)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 1 day ago
parent
commit
39c50dc013
1 changed files with 6 additions and 0 deletions
  1. 6 0
      searx/botdetection/http_sec_fetch.py

+ 6 - 0
searx/botdetection/http_sec_fetch.py

@@ -82,6 +82,12 @@ def filter_request(
     cfg: config.Config,
 ) -> werkzeug.Response | None:
 
+    if not request.is_secure:
+        logger.warning(
+            "Sec-Fetch cannot be verified for non-secure requests (HTTP headers are not set/sent by the client)."
+        )
+        return None
+
     # Only check Sec-Fetch headers for supported browsers
     user_agent = request.headers.get('User-Agent', '')
     if is_browser_supported(user_agent):