They probably told you on the Internet, nobody knows you're a dog? See, that was a lie. :)
j/k
lol
When using something like Unsplash I know they’ve got lots of resources and a good setup so calling out to their API seems safe enough.
But for a random service like this, I have no idea if they have the infrastructure to support a lot of calls. I don’t want to abuse a random service.
In this case I assume it is all behind a cdn and it’s no big deal for them.
But if you’re not sure and it turns out to be an important part of what you’re building, do you just setup your own cached version using varnish or something?
In general though hot-linking across domains like that is bad practice because the content on the other domain might change in a way you don't like. This was a pretty common practice for a while: https://tvtropes.org/pmwiki/pmwiki.php/Main/HotlinkedImageSw...
If those images turn out to be important to your project such that http.cats going down would be an issue, absolutely you should serve a copy of that content from your servers (assuming all the copyright licenses are in order).
For use in development & testing, sure. Or just as a goof to one of your coworkers. Honestly, I’ll admit I’ve used it countless times over the years to refresh my memory on a particular code, while knowing I’ll get a nice giggle of from it.
But in the scenario you are asking about, in an important production environment, you would be wise to cache the images and serve them in your method of choice yourself. Or better yet, just clone the repo and add install it on your server. It’s MIT licensed, so no worries as far as getting in trouble. Problem solved! :)
You can save yourself three keystrokes by using "!w http status codes"
For some reason, I always do Duck's bang things backwards. Like "http status codes w!"
I feel an obligatory 'Joe Exotic' reference should be considered here (but goes against the housecat vibe)
- Implement rate limiting on a site to deal with scrapers
- Include the https://http.cat/429 in the template for 429 responses.
- Time passes
- Implement API for displaying an information widget in customer company’s own website (big pharma regent suppliers), content get injected as an iframe loaded from our site.
- Customer employees all visit their own website from behind a reverse proxy with the same IP, trigger the (poorly configured) rate limiting
- Panicky customer contact: “Why is your widget displaying cat pictures on our website and could you please stop it right now”
This now forms a key foundation in my “no whimsy in code” rule along with one or two near misses with dummy data/content.
Some previous discussion:
3 years ago https://news.ycombinator.com/item?id=20283794
I don't care. It's so wonderful that I WANT this to show up on my feed every so often.
Less cool companies use 429.
HTTP Cats - https://news.ycombinator.com/item?id=20283794 - June 2019 (74 comments)
414 definitely brought back some memories...