Add cache headers on ActivityPub endpoints
Open, HighPublic



We should add caching headers on ActivityPub endpoints so we can use something like Varnish in front of WriteFreely.


Sending out posts on the fediverse cause the heaviest load on a WriteFreely server, as multiple servers all request the same resources within the same small period of time. Combining WF with caching software like Varnish could significantly reduce load on the application (and specifically the database), and this is the first step to enabling that.


At the very least, Varnish needs the Cache-Control header. To start, we should set this to a relatively small amount of time only on ActivityPub endpoints like:

  • Collections fetched via canonical URL with activity+json header (e.g. /matt/)
  • Collections fetched via API (e.g. /api/collections/matt)
  • Post fetched via canonical URL with activity+json header (e.g. /matt/my-post)
  • Post fetched via API (e.g. /api/collections/matt/posts/123someid456)

Event Timeline

matt triaged this task as High priority.Sep 9 2019, 7:59 PM
matt created this task.
matt moved this task from Far Future to Next Release on the WriteFreely board.
matt added a project: Restricted Project.