Automattic / Automattic/wordpress-activitypub
Post URLs intermittently serve ActivityPub JSON to browsers after upgrading to WordPress 7.1 (caching/content-negotiation regression)
- Dominant language
- PHP
- Stars
- 579
- Forks
- 92
- Avg merge
- 13h 5m
- Merged PRs (30d)
- 85
Description
### Quick summary
**Description**
Since upgrading WordPress core to version 7.1 (ActivityPub plugin was already on 9.2.2, unchanged across the update), I've had a report from a reader that clicking a post link from Mastodon led to a raw JSON response (the ActivityPub representation) instead of the normal HTML post page. Reloading/clicking the link again shortly after showed the correct HTML page.
This did not happen before the WordPress core update to 7.1, on the same hosting/caching setup and same ActivityPub plugin version.
**Environment**
- WordPress version: 7.1
- ActivityPub plugin version: 9.2.2
- PHP version: [si connue]
- Hosting: o2switch, using XtremCache Varnish
- Site: https://vincentbreton.fr
### Steps to reproduce
**Steps to reproduce**
- Publish a post
- A Mastodon instance/client fetches the post URL shortly after publishing (presumably for a link preview / federation), sending an Accept header that may include both `application/activity+json` and `text/html` as a fallback
- A human visitor clicking the same URL shortly after sometimes receives the JSON response instead of HTML
- The issue resolves itself after some time (presumably once the cache entry expires or is refreshed by another HTML request)
### Site owner impact
Fewer than 20% of the total website/platform users
### Severity
Moderate
### What other impact(s) does this issue have?
_No response_
### If a workaround is available, please outline it here.
_No response_
Contributor guide
Research direction
Start by reproducing the post URL request after publication with an Accept header containing application/activity+json and text/html, then compare the cached JSON and HTML responses on WordPress 7.1. Trace the ActivityPub content-negotiation and caching behavior; done means human browser requests consistently receive HTML while federation requests still receive JSON.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- api, backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100