weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.84k stars 187 forks source link

Request image be re-cached after failed initial load? #369

Closed bigonionbots closed 1 year ago

bigonionbots commented 1 year ago

This happens rarely, but the error sticks around for awhile. Accessing the following returns an error:

https://wsrv.nl/?url=https://cloudflare-ipfs.com/ipfs/bafybeiele2aqjavbyloohjupcwovj5g4qcx5rge3c2tietq7cyhtl4qebq/1564.png&w=300

{"status":"error","code":404,"message":"The requested URL returned error: 429"}

The url, however, works fine: https://cloudflare-ipfs.com/ipfs/bafybeiele2aqjavbyloohjupcwovj5g4qcx5rge3c2tietq7cyhtl4qebq/1564.png

My guess is that at the moment it was initially being accessed it might not have existed, so the error was valid, but now that it does exist it still returns the error. IPFS sometimes takes a little bit to propagate, it seems -- I can check for the error to catch it, but it seems once it's been attempted and fails the error is kept in the cache.

Is there an argument or something I can add when accessing later on to request that the image be re-cached?

Thanks!

bigonionbots commented 1 year ago

It appears the error resolved after a couple of hours (the first link returns the correct image). However, my question still stands as this occurs occasionally for me. Thanks!

andrieslouw commented 1 year ago

HTTP Error 429 indicates rate limiting, so it could be an issue due to too many requests from our servers to cloudflare-ipfs.com. These errors are not fixable on our side, we have limited IP-space to spread the requests, and we need to send millions of requests an hour to origins.

You could try to host the proxy yourself, so that others are not impacting towards the rate-limiting that cloudflare-ipfs.com imposes.

andrieslouw commented 1 year ago

In addition, errors are only cached for a few minutes. We have shortened this time as much as is feasible, it should be somewhere around 15 minutes.

bigonionbots commented 1 year ago

You could try to host the proxy yourself, so that others are not impacting towards the rate-limiting that cloudflare-ipfs.com imposes.

This worked wonders -- thanks for the suggestion!