@futtta @pfefferle @javiercasares
How about: add header Vary: Accept
Also define DONOTCACHE for PHP caching plugins that won't support varying cached content.
@futtta @pfefferle @javiercasares
How about: add header Vary: Accept
Also define DONOTCACHE for PHP caching plugins that won't support varying cached content.
@webaware @javiercasares @futtta the problem here is, that multiple headers are valid/possible by the spec: https://www.w3.org/TR/activitypub/#retrieving-objects
What about to check for HTML accept header: something like do only cache if ther is `text/html` in the accept header? Cachify uses something similar: https://github.com/pluginkollektiv/cachify/pull/273/files
@javiercasares @futtta @pfefferle I reckon setting that Vary header will do the trick, for nginx at minimum and possibly some others.
@webaware @futtta I'll check with @pfefferle and see what we can do.
Also note that the ActivityPub plugin doesn't look for only that one exact header, it looks for four of them:
No so fast; that's not what I said in my post. I said that if you *wanted* to break cache for (that specific) Accept header, that's how you'd do it.
But please read the thread from this post and below, where @rmccue argues that we *should* be caching JSON requests, and when.
https://aus.social/@rmccue/110020902246277742
Also note that caching some JSON requests are highly desirable, like oembed requests for example.
https://snippets.webaware.com.au/snippets/caching-oembed-with-nginx/
If your (host is) using typical nginx config like this one on WP docs:
https://wordpress.org/documentation/article/nginx/#nginx-fastcgi_cache
Then you should be able to break caching with this:
if ($http_accept = "application/json") {
set $no_cache 1;
}
But nginx will cache different content based on the Accept header if you tell it to, e.g. as long as #WordPress #ActivityPub sends this with its responses, cache will differ by Accept header:
header('Vary: Accept');
https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache_valid
@webaware @futtta that goes to Docs
https://github.com/WordPress/Advanced-administration-handbook/issues/189
#activitypub #wordpress #nginx does anyone have nginx example config to avoid activitypub requests (accept:application/json) being cached by nginx? I'm trying to "educate" my hosting company ;-)
@futtta @webaware @javiercasares sure, but I thought as a quick fix :)
@webaware @futtta @javiercasares But then caching would be unnecessary, because ActivityPub needs content negotiation for posts, pages, other post types and author pages. and then there is not much left to cache :)
@webaware @futtta @javiercasares Btw. @donncha also added Accept header support to "WP Super Cache" https://github.com/Automattic/jetpack/pull/29456/files
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.