Omit User-Agent header in image proxy to avoid being blocked
This commit is contained in:
parent
2309b27458
commit
b113af8472
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue