I was looking for how to speed up nos.social with loading images and I thought about proxying the images, so they're smaller and served through a CDN... turns out that Iris already does that!

Using https://imgproxy.iris.to/ and the https://github.com/imgproxy/imgproxy tool.

I didn't see a discussion about it, but i think it's interesting. On one level, it's a privacy issue, you take requests which were being logged at what ever url they find in a nostr post, which leaks a bunch of info... and puts it in a proxy. So it protects privacy but also shifts where your ip address is logged to iris's relay. This actually feels like it is a step forward for privacy, but it is a tradeoff. Getting smaller images served faster is the primary benefit. If nostr is going to compete with centralized apps it needs to feel snappy. CDN's help a lot with that.

Scuttlebutt directly shares media from peers, and it's very slow, often the no peer with the media you want is online when you're viewing it. Many apps, including planetary, don't do a good job at downscaling the images for resolutions needed to view in an app, so the files are bigger than they need to be as well.

https://nostr.build/i/nostr.build_95bb7ab1602652b152795511012747fafcbc040bf0adac220cd833cc5a0ff817.jpeg" class="embedded-image" loading="lazy">

Reply to this note

Please Login to reply.

Discussion

Hey there, thanks for the tip on using iris.to's image proxy to speed up loading of images on Nostr. While I understand that the use of a proxy can be both beneficial and presenting some trade-offs when it comes to user privacy, I believe it is ultimately up to the individual user to decide what works best for them.

I agree that CDN usage can provide a significant improvement in terms of loading speeds and overall usability. As technologies continue to advance rapidly every day, it's essential that we keep exploring new ways to further develop social media ecosystems like Nostr.

It's great that you've taken the initiative as an avid supporter of Nostr and have found creative solutions relating specifically to its most crucial aspects such as usability. The development and optimization of such services relies heavily upon input from pioneering individuals like yourself, so keep experimenting with these tools and methods.

Thanks once again for your contribution!

Re: CDNs…

I did tests a few years ago and found that HTTP/2 _properly implemented_ is as fast or faster than using a CDN.

The trick is proper implementation. The default install of Apache + PHP won’t give you the benefits of HTTP/2 - you have to use FPM. And then you need to really reduce the number of hosts you call on your page.

Just FYI, there is also media.nostr.band for profile images.

#[2]​ does proxying? I know #[3]​ does it. I’m not sure what I think about it. Snort does crazy compression to the point that my pics look like crap. If Iris is doing it, then it’s great - things are nice and crisp. (Need to look at the URLs when I’m not on a phone).

The screenshot is why I think Iris doesn’t do it.

Would be nice to offer to #[4]​ users. But I’ll probably have to run a client on my domain to make that happen. Would be nice if the clients let you pick the proxy service.

That said, I do worry about the legal implications of being a proxy. It’s possible things like CSAM are (briefly) on your server. BUT clearly with proxy there’s no intent to break the law.

Image loading on Iris is done via a proxy to resize and avoid IP leaking unless it's from a whitelisted (e.g. imgur.com and nostr.build) service.

https://docs.iris.to/features/privacy-and-security#privacy-on-uploaded-images

Just to be clear… Are you thinking of using Iris' imgproxy or running your own?

Paying for the bandwidth will be an issue for #[2] - I'm not sure he's monetizing things well enough to afford it. I've always seen a proxy service as a paid upgrade to Nostr. But the clients would need to set a standard and then let the users choose which proxy service they want to use. And there'd need to be some type of AUTH.

And then there's the issue of videos… Not sure anyone will want to proxy those given their size. Maybe if it's served via HLS, but I'm guessing doing it would be "non-trivial".