From 612b76b75e9128201ff4e9042e1f5a2829f7d3cd Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 7 Aug 2025 20:50:31 +0200 Subject: [PATCH] [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 --- searx/webapp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(