From b113af8472f049b6ede5aacab7060454851d3a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sun, 9 Jan 2022 20:18:08 -0800 Subject: [PATCH] Omit User-Agent header in image proxy to avoid being blocked --- ui/proxy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/proxy.go b/ui/proxy.go index 663eea45..cd175852 100644 --- a/ui/proxy.go +++ b/ui/proxy.go @@ -45,7 +45,8 @@ func (h *handler) imageProxy(w http.ResponseWriter, r *http.Request) { html.ServerError(w, r, err) return } - req.Header.Add("User-Agent", config.Opts.HTTPClientUserAgent()) + + // Note: User-Agent HTTP header is omitted to avoid being blocked by bot protection mechanisms. req.Header.Add("Connection", "close") clt := &http.Client{ @@ -60,7 +61,7 @@ func (h *handler) imageProxy(w http.ResponseWriter, r *http.Request) { defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - logger.Error(`[Proxy] code=%d url=%q`, resp.StatusCode, imageURL) + logger.Error(`[Proxy] Status Code is %d for URL %q`, resp.StatusCode, imageURL) html.NotFound(w, r) return }