• Resolved davidpwhelan

    (@davidpwhelan)


    I posted my first WordPress post after activitating the ActivityPub plugin and it appeared on Mastodon. Initially, I clicked through to it and it looked like a normal WordPress post and I’m assuming was cached as I saw it. Later, a subscriber contacted me and was getting something very different (I’m not sure what this is). When I returned to the page, I saw the same thing. I was so focused on trying to get the actual post to display, I only kept a screenshot:

    When I cleared the page cache (I’m using WP-Optimize), there was no change in what appeared in the browser after a CTRL-F5 refresh. When I deactivated the ActivityPub plugin, WordPress displayed the normal blog post. When I reactivated the plugin, it continued to show the blog post correctly. I’m just guessing but it seems like a cache issue and related to the ActivityPub output.

    I’m wondering if it’s the same issue as this one, which might be solved by excluding paths from cache. But since the URL involved has returned both the correct post and the ?JSON?, I’m not really sure what to exclude from cache. (I’m also not entirely sure it’s cache, as I had to turn off Cloudflare’s bot fight mode to enable Mastodon to receive the post, and I’m wondering if Cloudflare is interfering in other ways).

    Do you have any guidance/pointers on caching whatever it is ActivityPub generates to isolate it from the WordPress content (if that’s what that output is), so that the two pieces don’t overlap in cache?

    Thanks for any help. I don’t honestly know how you stay on top of all of these interactions without cloning yourself, so I appreciate your time. If you could even tell me where I might look next, I’m happy to do that.

    The page I need help with: [log in to see the link]

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

    (@pfefferle)

    Hey @davidpwhelan ??

    Sadly ActivityPub (the spec) requires Content Negotiation which does not play very nicely with classic shared hosting envs and quire some caching plugins.

    Some context: To get the JSON version of a post or a profile, Mastodon queries the post or author URL with the Accept header application/activity+json

    curl "https://ofaolain.com/blog/2023/10/18/misdirected-mastodon/" \
         -H 'Accept: application/activity+json'

    This is a nice feature for platforms, because they can use the author and post URL also as an API.

    The problem is, that caching plugins have to use different caching buckets for the normal request and the application/activity+json request.

    There are some plugins that support this feature like wp-super-cache or cachify. Or maybe you will be able to configure an Accept header switch in the plugin?!?

    Thread Starter davidpwhelan

    (@davidpwhelan)

    Thank you. This is very helpful and I appreciate you taking the time. With this information, I’ve got some things I can follow up on and see if they impact the caching. At the least I can be expecting this might repeat and be prepared for it. Thanks again and thanks for the plugins.

    Thread Starter davidpwhelan

    (@davidpwhelan)

    Follow up: I kept the WP-Optimize plugin but turned off the cache. After looking at the caching suggestions, I found Cachify had not been updated in some time. I installed WP-Super-Cache and it created HTML-only cached pages, which seems to have solved the problem for what’s being cached on my end. I looked at Cloudflare’s caching just to be sure but it doesn’t seem to cache JSON (or HTML) unless you tell it to, so it wasn’t part of the problem. After moving to WP-Super-Cache, Mastodon was able to grab the lastest blog post and there was no JSON cached. Thanks again for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Caching Conflict between WordPress Post and Other Output’ is closed to new replies.