Hacker News new | ask | show | jobs
by mimsee 252 days ago
If I wanted to achieve the same result, that is to serve assets of others from my own domain, I'd just create a custom endpoint like /api/user-avatar/:userId and an action proxies the actual image from google, maybe keep a cached copy for some time to not have to redownload the image on every request.
2 comments

Especially since, if you were doing this on CloudFlare—which you can with OpenNext—it's incredibly simple to work with CloudFlare's caches in Workers. For example: https://developers.cloudflare.com/workers/examples/cache-usi...

Plus there's their Images service which could come in handy to transform them a bit, too, if you wanted.

This. Only needs a couple lines of nginx config.