WP ActivityPub and caching issues

The old “WordPress is serving up pure JSON instead of HTML” bug has been popping up intermittently since I reactivated the ActivityPub plugin. Since the ActivityPub plugin developers consider it solved, I’ve been looking into it to understand how I can fix it.

The problem arises because AP alters WordPress behaviour to respond to a request to a specific URL with either JSON (sensible if the request is from an ActivityPub client) or HTML (smart if the request is from a human who wants to view the website).

If you’re using a caching solution, it needs to support this functionality. Breeze, which I’m currently using, does not. As a result, the cache “log” and continue to serve whatever the first response to a particular URL request is.

Which sucks.

I saw that the always helpful Jan Boddez had face the same issue, so I reached out. His helpful response led me to the Surge plugin, and this helpful post from Dominik Schilling on how to configure it to account for this scenario.

Unfortunately, I haven’t had time to implement the switch yet. This note is really just a way of documenting the troubles for my own sake, and saving the relevant links for implementing the fix.

And, to that end, a final note to myself: Remember to activate the Vary-Header in the ActivityPlugin by setting the ACTIVITYPUB_SEND_VARY_HEADER constant.

This piece of digital gardening is brought to you by the esteemed president of said garden, the procrastination monkey.

More notes

All notes

Responses

Respond to this with a webmention, a reply from your fediverse account or a comment using the form below.

Want to discuss in private?

 

Email

 

me.

Leave a Reply

Your email address will not be published. Required fields are marked *