From c2d9c93b3baf365c42a8ba93d965d404dfb5741d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 19 Feb 2022 14:26:58 +0100 Subject: [PATCH] [fix] image_proxy: allow HTTP redirects Without redirects the load of various images will fail when image_proxy is enabled [1]. [1] https://github.com/searxng/searxng/pull/910#issuecomment-1045966577 Suggested-by: @dalf [1] Signed-off-by: Markus Heiser --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/webapp.py b/searx/webapp.py index 5e05f9781..eb08d63d9 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1132,7 +1132,7 @@ def image_proxy(): 'DNT': '1', } set_context_network_name('image_proxy') - resp, stream = http_stream(method='GET', url=url, headers=request_headers) + resp, stream = http_stream(method='GET', url=url, headers=request_headers, allow_redirects=True) content_length = resp.headers.get('Content-Length') if content_length and content_length.isdigit() and int(content_length) > maximum_size: return 'Max size', 400