• Resolved hardillb

    (@hardillb)


    Hello,

    I’ve recently started to use the ActivityPub plugin to federate my posts to the Fediverse (e.g. mastodon) and I’ve been running into issues with certain profiles not working correctly.

    The ActivityPub developers suggested it may be down to the caching I have enabled.

    Does W3 Total Cache honour the Content Negotiation Headers (e.g. Accept: application/json) when serving objects from the cache?

    If not can I make a feature request to enable this.

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter hardillb

    (@hardillb)

    Just for a reference, after disabling the Object Cache the ActivityPub plugin works as expected.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @hardillb

    Thank you for reaching out and I am happy to help!
    Can you please share what is the caching method you are using for Object Caching and are you caching the wp-admin requests in Performance>Object Cache?
    Thanks!

    Thread Starter hardillb

    (@hardillb)

    Hi,

    I’m using the “disk” cache with the default settings. (wp-admin caching is disabled)

    I believe the problem is that the cache is not taking the content type into consideration, e.g. if the page is requested with Accept: text/html and then subsequently requested with Accept: application/activity+json the HTML version is still returned.

    With the Object Cache disabled I get the correct version with each request.

    e.g.

    curl -H “Accept: application/activity+json” https://blog.hardill.me.uk/2024/09/26/new-geographic-node-red-nodes/

    vs

    curl -H “Accept: text/html” https://blog.hardill.me.uk/2024/09/26/new-geographic-node-red-nodes/

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @hardillb

    Thank you for your feedback.
    Just to mention, it’s not recommended to use Disk cahcing method for Object Caching as the cached files are stored to disk. Do you have the option to use Redis or Memcached on your server?
    I need to check this more and see what may be causing this because I am not familliar with the plugin you are mentioning, and I am having trouble finding any documentation for it.

    Thanks

    Thread Starter hardillb

    (@hardillb)

    No, this is a self hosted setup and I don’t have somewhere to run redis or memcache at the moment.

    I can probably live with Object Cache turned off for now, but it would be good to support caching multiple formats for a given object as I expect the ActivityPub plugin to get a lot of use.

    Plugin:

    https://github.com/Automattic/wordpress-activitypub

    Hey @vmarko ??

    I am the author of the ActivityPub plugin and happy to support! The content negotiation part is described here: https://www.w3.org/TR/activitypub/#retrieving-objects

    I have a list of caching plugins that already support it, maybe it helps: https://github.com/Automattic/wordpress-activitypub/wiki/Caching

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @hardillb

    Thank you for the information.
    Yes, I’ve already found all the resources, however, there are no known issues with Persistent Object Caching.
    We’ll investigate this more and I’ll get back to you once we have more info

    Thanks!

    Thread Starter hardillb

    (@hardillb)

    Just a quick update, after more playing this weekend it appears to be the Page Cache not the Object cache that is the problem.

    I’ve managed to install the PHP Redis extension into the standard WordPress container and when using Redis for Page Cache things look to work correctly.

    I think the Object Cache comment earlier may have been because I’d cleared the caches as part of testing different configurations.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.