Thread

Zero-JS Hypermedia Browser

Relays: 5
Replies: 2
Generated: 20:20:24
Yes, agreed, 512 MB of caching for something like njump.me is basically nothing. That’s the nature of caches. Especially with crawlers doing range scans, cached stuff will certainly be evicted. Cloudflare also wants you to upgrade to an Enterprise plan so they can make money that’s how you unlock the much more useful 5 GB cache. Still, there are things you can do with the Free and Business tiers, such as Cache Rule magic, Tiered Cache, Cache Reserve (very useful, but the R2 free tier is consumed quickly and costs can shoot up), Always Online, etc. nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gprfmhxue69uhhq7tjv9kkjepwve5kzar2v9nzucm0d5hszxmhwden5te0wfjkccte9emk2um5v4exucn5vvhxxmmd9us2xuyp a few comments on your changes: 1. For immutable events, there’s no reason not to cache them for a whole year. You can always purge items from the Cloudflare cache if really needed. Also,`public` is implied by `s-maxage`. Finally, I forgot to mention this earlier, but `stale-while-revalidate` can also help keep things running faster for end users when njump.me is under load. ``` Cache-Control: max-age=604800, s-maxage=31536000, stale-while-revalidate=86400, immutable ``` 2. I don’t think the `ETag` implementation based on event ID worked, or maybe Cloudflare is stripping it: https://developers.cloudflare.com/cache/reference/etag-headers/ . When I hit an event rendering endpoint I'm not getting an ETag back. Also, don’t forget to add one to the profile rendering endpoint, since I assume this is one of the most popular kinds that can’t be made immutable when caching. Without either `Last-Modified` or `ETag`, Cloudflare falls back to "Smart Edge Revalidation", which, while better than nothing, in my experience can be finicky with the reverse-proxy hitting the server quite often: https://developers.cloudflare.com/cache/concepts/revalidation/ . So it’s definitely worth sending at least one of these headers on all cache-enabled responses.
2025-09-29 12:15:34 from 1 relay(s) ↑ Parent 2 replies ↓
Login to reply

Replies (2)

nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gprfmhxue69uhhq7tjv9kkjepwve5kzar2v9nzucm0d5hszxmhwden5te0wfjkccte9emk2um5v4exucn5vvhxxmmd9us2xuyp, also, sir, I fully support your right to unfollow me and ignore any notifications you’re tagged in for whatever reason you see fit. I’m not entitled to your attention, just as others aren’t entitled to mine. That said, if you want to collaborate, it would be nice if we had a system to reach out to each other that doesn’t rely on a third party sending you a link, or me being left in limbo indefinitely, not knowing if you’ve even seen something. Ideally, something that doesn’t burden you too much but still allows me to eventually get either an answer, or at least an acknowledgement that you read the stuff and don’t think it’s worth replying to (which I'll take as "IDC, just do whatever you want" answer). Since notifications for kind 1s and comments you’re tagged in, DMs, and shared communities are all either not working or not to your liking, and since you’re also slowly moving away from GitHub (which has awful notifications too), maybe a weekly or monthly NAK req for events you’re tagged in could work? Especially for the "unimportant" / less well-known devs who are still trying to build OSS projects on Nostr if you need to filter all the other crap that you get tagged in. I stand by my position that lack of, or broken, communication is the number one issue with Nostr development at the moment (ot at least for me it is). We need a way to fix this.
2025-09-29 12:38:56 from 1 relay(s) ↑ Parent 1 replies ↓ Reply
Link about Cache Reserve: https://developers.cloudflare.com/cache/advanced-configuration/cache-reserve/ It usually works out quite cheaply for purely HTML, JS and CSS content. But costs can skyrocket for media or attacks that aren’t caught by Cloudflare. You may also want to block certain IPv6 addresses from Cloudflare Workers that are known sources of attacks and missconfigured Nostr stuff, e.g., 2a06:98c0:3600::103 alone cost me more than all the old-school script kiddies’ botnet attacks combined. If you do enable Cache Reserve for njump, make sure you have proper alerts in place, both for the sake of budgeting and so that you can react fast to attacks, disable fancy caching and switch to under-attack mode if you are targeted.
2025-09-29 13:05:40 from 1 relay(s) ↑ Parent Reply