summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2025-08-07 20:50:31 +0200
committerGitHub <noreply@github.com>2025-08-07 20:50:31 +0200
commit612b76b75e9128201ff4e9042e1f5a2829f7d3cd (patch)
tree583f2d46b9735d987d1edc3978b972bd6cd231fd /searx/webapp.py
parent4942c9b914d45dae9aadf193c97ddeb4acc8a466 (diff)
[fix] webapp.py: default_http_headers not parsed as strings (#5094)
WhiteNoise requires all headers to be strings, however it's common to use other primitive types (e.g. numbers) in the header, e.g. `X-XSS-Protection: 0`. Thus, we must convert all types of values (i.e. numbers) to strings. - closes https://github.com/searxng/searxng/issues/5091
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index f482d4a1a..906ec93e4 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1387,7 +1387,8 @@ def static_headers(headers: Headers, _path: str, _url: str) -> None:
headers['Cache-Control'] = 'public, max-age=30, stale-while-revalidate=60'
for header, value in settings['server']['default_http_headers'].items():
- headers[header] = value
+ # cast value to string, as WhiteNoise requires header values to be strings
+ headers[header] = str(value)
app.wsgi_app = WhiteNoise(