• Resolved unmus

    (@unmus)


    Hey!

    Question: Is there a need to cache the activity pub API endpoints?

    Background is, my wordpress is running on a traditional shared webhosting environment. Normally I do not have many traffic on it. But in the past, I had several posts, which has gone viral. This means, they were shared on „Twitter“ from large accounts with thousand of followers. This was not a problem as not every follower click on the links. But in this case, based on my understanding, every instance (of the followers) would fetch the federated post from the blog.

    Do you have a recommendation how to handle this? Or do you not see the need to take action? Is there anywhere a list of all API endpoints of the plugin?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matthias Pfefferle

    (@pfefferle)

    Hey @unmus 👋

    I think @donncha might be able to help here!?! I might remember that he uses API caching with the plugin!?!

    Yeah, I use WP Rest Cache to cache API requests and it made a huge difference to the load on my server. You’ll need to use a full page caching plugin too because the servers will make requests for the page itself.

    I recommend using Jetpack Boost or WP Super Cache for that.

    Plugin Contributor Konstantin Obenland

    (@obenland)

    Do you have a filter that adds Activitypub endpoints to the allowlist? It doesn’t look like WP Rest Cache includes them out of the box.

    Thread Starter unmus

    (@unmus)

    In the meantime I am some steps further and have implemented caching for the activity pub endpoints. I am using WP Rocket and WP REST CACHE as Plugins.

    But I would have further questions regarding the technical approach.

    1. Is there any recommendation for the caching strategy? For example, cache endpoint A, but do not cache endpoint B.
    2. Are there any actions (do_action) in the activity pub plugin available, which could be used as trigger to clean the regular page cache (for example, comment is incomming, action is fired > I use the action to clean the cache in WP Rocket, that the comment is visible directly on the affected page).
    3. Is there a list of all activity pub endpoints of the plugin, that I can verify I am caching everything required?
    4. Which endpoint is responsible to deliver the post content into the fediverse?

    @obenland WP REST CACHE is providing a filter to add custom endpoint to the allowed list. Please see the Q&A section of the plugin. The following link contains an implementation example.

    https://epiph.yt/blog/2025/das-activitypub-plugin-und-der-versehentliche-ddos/

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Caching Activity Pub Endpoints’ is closed to new replies.