Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. General Discussion
  3. #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?

Scheduled Pinned Locked Moved General Discussion
activitypubevanpollpoll
11 Posts 5 Posters 2 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • evan@cosocial.caE evan@cosocial.ca

    #ActivityPub developers: which of these HTTP caching headers does your software publish or consume?

    #EvanPoll #poll

    james@bne.socialJ This user is from outside of this forum
    james@bne.socialJ This user is from outside of this forum
    james@bne.social
    wrote last edited by
    #2

    @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.

    1 Reply Last reply
    0
    • evan@cosocial.caE evan@cosocial.ca

      #ActivityPub developers: which of these HTTP caching headers does your software publish or consume?

      #EvanPoll #poll

      julian@activitypub.spaceJ This user is from outside of this forum
      julian@activitypub.spaceJ This user is from outside of this forum
      julian@activitypub.space
      wrote last edited by
      #3

      @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 🙂

      1 Reply Last reply
      0
      • evan@cosocial.caE evan@cosocial.ca

        #ActivityPub developers: which of these HTTP caching headers does your software publish or consume?

        #EvanPoll #poll

        rimu@piefed.socialR This user is from outside of this forum
        rimu@piefed.socialR This user is from outside of this forum
        rimu@piefed.social
        wrote last edited by
        #4

        Cache-Control and Vary

        1 Reply Last reply
        1
        • evan@cosocial.caE evan@cosocial.ca

          #ActivityPub developers: which of these HTTP caching headers does your software publish or consume?

          #EvanPoll #poll

          nick@hhmx.deN This user is from outside of this forum
          nick@hhmx.deN This user is from outside of this forum
          nick@hhmx.de
          wrote last edited by
          #5

          @evan@cosocial.ca

          None of them... yet... 😉

          1 Reply Last reply
          0
          • evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.ca
            wrote last edited by
            #6

            @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.

            julian@activitypub.spaceJ 1 Reply Last reply
            0
            • evan@cosocial.caE evan@cosocial.ca

              #ActivityPub developers: which of these HTTP caching headers does your software publish or consume?

              #EvanPoll #poll

              evan@cosocial.caE This user is from outside of this forum
              evan@cosocial.caE This user is from outside of this forum
              evan@cosocial.ca
              wrote last edited by
              #7

              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.

              evan@cosocial.caE 1 Reply Last reply
              0
              • evan@cosocial.caE evan@cosocial.ca

                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.

                evan@cosocial.caE This user is from outside of this forum
                evan@cosocial.caE This user is from outside of this forum
                evan@cosocial.ca
                wrote last edited by
                #8

                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).

                evan@cosocial.caE 1 Reply Last reply
                0
                • evan@cosocial.caE evan@cosocial.ca

                  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).

                  evan@cosocial.caE This user is from outside of this forum
                  evan@cosocial.caE This user is from outside of this forum
                  evan@cosocial.ca
                  wrote last edited by
                  #9

                  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.

                  1 Reply Last reply
                  0
                  • evan@cosocial.caE evan@cosocial.ca

                    @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.

                    julian@activitypub.spaceJ This user is from outside of this forum
                    julian@activitypub.spaceJ This user is from outside of this forum
                    julian@activitypub.space
                    wrote last edited by julian@activitypub.space
                    #10

                    @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.

                    1 Reply Last reply
                    0
                    • evan@cosocial.caE This user is from outside of this forum
                      evan@cosocial.caE This user is from outside of this forum
                      evan@cosocial.ca
                      wrote last edited by
                      #11

                      @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!

                      1 Reply Last reply
                      1

                      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
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups