Closed abargiela closed 2 years ago
This fails because the upstream URL redirects to itself.
$ curl -I "https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/FWTCLBCR7QI6ZA6S3HNLBYR3PY.jpg&w=916" location: https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/FWTCLBCR7QI6ZA6S3HNLBYR3PY.jpg&w=916
On Google Chrome, this will result in an ERR_TOO_MANY_REDIRECTS
error message (try opening that URL in an incognito tab, for example). Our service will return a 404 with this error message:
{"status":"error","code":404,"message":"Will not follow a redirection to itself"}
(all upstream errors are remapped to 404, the JSON response always contains more details)
Browsers usually have a reload mechanism that tries to reload the page after giving that error message (since invalid cookies could cause this behavior). Our service doesn't have such mechanism and also intentionally ignores any cookies during redirects.
The reason that the upstream server is configured this way is presumably for hotlink protection. Note that our service is intended for caching and manipulating images, not for bypassing hotlink protection (that's also why we deliberately ignore all cookies).
Thank you for your quick response @kleisauke
Hello, We self host the project but we noticed that the same problem we have on our self hosted project, we also have using your URL( https://images.weserv.nl), so I would like to understand if it's possible to fix that in a self hosted project, can you help me?
The URL we are trying to reach: https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/FWTCLBCR7QI6ZA6S3HNLBYR3PY.jpg&w=916
Using curl, we have 2 behaviours:
No cookies/no headers
We notice that it returns 302, and I suspect that could be the reason why the application is returning 404.
With cookies/no headers
here we have 200 OK as return
Request using https://images.weserv.nl
It
returned 404
but the expected behavior would be return200 OK
Thank you in advance!