[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 <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-02-19 14:26:58 +01:00
parent 4a28b593c2
commit c2d9c93b3b
1 changed files with 1 additions and 1 deletions

View File

@ -1132,7 +1132,7 @@ def image_proxy():
'DNT': '1', 'DNT': '1',
} }
set_context_network_name('image_proxy') 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') content_length = resp.headers.get('Content-Length')
if content_length and content_length.isdigit() and int(content_length) > maximum_size: if content_length and content_length.isdigit() and int(content_length) > maximum_size:
return 'Max size', 400 return 'Max size', 400