Published
SUCCESSFUL Adventures in setting up ActivityPub + Webfinger on a Flywheel-hosted WordPress site
Updated 31 October 2023 at 2:45pm to edit the NGINX config and give a further explanation.
Emerson from Flywheel did more digging in the Fastly cache documentation and realized that we could tweak the NGINX config to fully support content negotiation. He added a Vary
header to the necessary URLs et voilà, everything started working properly. Now, courtesy of Matthias Pfefferle’s great WordPress plugins and Flywheel’s dogged help, you can follow this blog on Mastodon if you search for @blog@piperhaywood.com or https://piperhaywood.com/@blog.
For future reference, this is the NGINX config tweak that got ActivityPub and Webfinger working on Flywheel with their Fastly caching setup:
location ~* /.well-known/webfinger {
default_type application/activity+json;
add_header Vary Accept;
include internal-proxy.conf;
}
location ~* / {
add_header Vary Accept;
include internal-proxy.conf;
}
It’s fairly self-explanatory, but essentially the first location
block ensures that all Webfinger endpoints have a default content type of application/activity+json
, adds a Vary
HTTP header so that Flywheel’s caching via Fastly will cache different versions of the page depending upon the content type, and includes further configuration via an internal-proxy.conf
file. The second location
block ensures that all URLs across the site basically do all of the above, but no default content type is set. (TBH I feel like I might only need the second block… but at this point everything is working nicely so I’m not going to ask the kind souls at Flywheel to change the config yet again!)
Colin from Flywheel explained the internal-proxy.conf
file to me in my far-too-long support ticket:
The
internal-proxy.conf
is indeed an internal file that has platform-specific rules. Some of this config file is just simple cache rules, excluding common paths, whereas other parts are potentially sensitive as they pertain to our load balancing and proxy configs.
So that’s it! You can follow this blog now on Mastodon, and all blog posts published after October 30th should show up.