Compatibility with ActivityPub plugin Accept header
Describe the bug The issue is that ActivityPub has a different output for the same page depending on the value of the Accept header.
What happens here is that once we cache the page, we keep on sending the same cache even if the Accept header is not the same. And our REST API cache mechanism deals only with /wp-json/ URLs.
To Reproduce Steps to reproduce the behavior:
- Install the ActivityPub plugin
- Visit a post in the Browser (so that the post will be cached)
- Visit the post with Accept header
application/activity+json> it returnsHTML output> wrong output - Then deactivate WP Rocket
- Visit the post with Accept header
application/activity+json>JSON output> correct output
Expected behavior
To make this compatible, we’d need to be able to detect the Accept header and generate a different cache based on that. So, if the requester sends Accept: application/activity+json we should deliver a different page. Alternatively, we could bypass the cache when application/activity+json is calling one of their REST endpoints.
Additional context
- Slack Discussion 1
- Slack Discussion 2
- Ticket: https://secure.helpscout.net/conversation/2937947511/560485
Related: https://github.com/wp-media/wp-rocket/issues/2528