#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
-
T tag-activitypub@relay.fedi.buzz shared this topic
-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
@evan My systems export both Etag and Last-Modified. I have no idea how the computers looking at my stuff know which to prioritise, and typically on my browser I still need to refresh the page manually to see any changes. Caching really is quite hard.
-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
@evan@cosocial.ca all four, but only for contexts. It's how NodeBB's topic synchronization logic works, although there isn't an FEP for it yet

-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
Cache-Control and Vary
-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
None of them... yet...

-
@julian hmmm. With a reverse chron collection you can do pretty well with `totalItems` and the first item on the first page.
If there were net items added or deleted, `totalItems` will be different.
If the same number of items were added and deleted, the most recent item will be different.
So you can check synch with a couple of hits.
-
#ActivityPub developers: which of these HTTP caching headers does your software publish or consume?
Thanks to everyone who replied! Unfortunately HTTP caching is not our strong suit in the ActivityPub world; HTTP Signature header(s) are a real public cache buster. But you can do at least some good caching per user. tags.pub provides ETag, and sends If-None-Match and If-Modified-Since, but doesn't do Last-Modified well yet.
-
Thanks to everyone who replied! Unfortunately HTTP caching is not our strong suit in the ActivityPub world; HTTP Signature header(s) are a real public cache buster. But you can do at least some good caching per user. tags.pub provides ETag, and sends If-None-Match and If-Modified-Since, but doesn't do Last-Modified well yet.
The problem with Signature: and Signature-Input:
If the server wants to say, "this content is different for different users", you use the Vary header. For OAuth, you'd use Vary: Authorization, say. And the cache knows to separate data for different users. Same OAuth token, you can reuse the cached data.
We include our ID in the Signature (or Signature-Input) header. But we also include a timestamp there, so every single request has a different signature (by design).
-
The problem with Signature: and Signature-Input:
If the server wants to say, "this content is different for different users", you use the Vary header. For OAuth, you'd use Vary: Authorization, say. And the cache knows to separate data for different users. Same OAuth token, you can reuse the cached data.
We include our ID in the Signature (or Signature-Input) header. But we also include a timestamp there, so every single request has a different signature (by design).
It would probably be good if we had a separate identity header, so servers can say, "this stuff is different by user, this is the same for every user" with Vary: Signature-Key-Id or something.
-
@julian hmmm. With a reverse chron collection you can do pretty well with `totalItems` and the first item on the first page.
If there were net items added or deleted, `totalItems` will be different.
If the same number of items were added and deleted, the most recent item will be different.
So you can check synch with a couple of hits.
@evan@cosocial.ca yes, you can but that's not the point I think?
The point is that generating the collection is more expensive than returning the ETag, if it's cached (and it is, with NodeBB).
So if I wanted to check the context for updates, I could issue a lightweight HEAD instead of a GET, and the target server could simply bounce back the ETag.
Likewise, I think it sends the appropriate http response (
304 Not Modified) when If-None-Match matches the ETag, or something. So I think with collections of object ids, the savings are minimal but it could add up to much more for endpoints that return entire objects... Like an outbox!It's been awhile since I worked on that code.
-
@julian ah, right! I meant, many Fediverse servers don't do a good job with caching headers, but you can use some of the data to guess if there have been changes. Caching headers are better though!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login