Skip to content

Support for WP REST Cache #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft

Conversation

obenland
Copy link
Member

@obenland obenland commented Apr 30, 2025

See https://wordpress.org/support/topic/caching-activity-pub-endpoints/
See https://epiph.yt/en/blog/2025/accidental-ddos-through-activitypub-plugin/

Proposed changes:

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

/cc @MatzeKitt

@obenland obenland self-assigned this Apr 30, 2025
@github-actions github-actions bot added [Focus] Compatibility Ensuring the plugin plays well with other plugins [Status] In Progress labels Apr 30, 2025
@obenland
Copy link
Member Author

obenland commented Apr 30, 2025

Proper cache invalidation will be the biggest challenge. New posts, new comments, user meta updates, blog user option updates, etc.

It would also be nice if we could avoid blanket-invalidating all cached ActivityPub endpoints for all of these, and be more targeted.

@MatzeKitt
Copy link
Contributor

So we need to keep track of any change regarding any of the endpoints? Also, do we need to check whether the change does actually change the API endpoint response or should we always invalidate the cache when it might change the response?

I guess we currently have no decorated list of changes we need to look for?

@obenland
Copy link
Member Author

obenland commented May 6, 2025

Also, do we need to check whether the change does actually change the API endpoint response or should we always invalidate the cache when it might change the response?

Looking a bit more at the plugin, I think we'll have to be pretty broad about invalidating caches. Most of the endpoints are user/actor-based, and WP REST Cache doesn't have a concept for that. It's post type and post_id, and that seems to be pretty much it.

I think your approach of defining a custom type and invalidating all associated endpoints is probably the safest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Compatibility Ensuring the plugin plays well with other plugins [Status] In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants