wordpress_ynh
wordpress_ynh copied to clipboard
Using Activitypub plugin: how to configure the redirection ?
Hello,
While trying to use the plugin Wordpress ActivityPub, I'm in trouble with the redirection to .well-known and nginx config. See https://github.com/pfefferle/wordpress-activitypub/issues/37
My wordpress is in a subfolder (let's call it subdirectory). So I tried to add rewrite ^/.well-known/ ^/subdirectory/.well-known/ last; in /etc/nginx/conf.d/domain.tld.conf.
A webfinger test (https://client.webfinger.net/lookup?) show me that it returns a text/html file. I'm pretty sure it's yunohost SSO page.
Should I exclude it from SSO ? How can I do that ?
You can add a skipped_regex to your wordpress to let this url pass through the sso.
ynh_app_setting set wordpress skipped_regex "domain.tld/path_url"
I tried with domain.tld/.well-known and domain.tld/subdirectory/.well-known, same result :(
edit: domain.tld/.well-known redirect to the SSO, domain.tld/subdirectory/.well-known to wordpress, page not found.
You should probably replace the - by a ., that's a regex.
Anyway, I can help you using YunoHost cli command, but I can't explain you how to use that plugin.
Ok thanks.
No problem, I was thinking that yunohost SSO could have been a problem.
For the record: for nextcloud this text/html page is just a missing resource (see: https://github.com/YunoHost-Apps/nextcloud_ynh/issues/198) while for wordpress it's really the SSO.
I'll check my regex, it might be wrong.
edit: I fixed the regex, same "missing resource".
Ok, I found the solution, the redirection wasn't good.
Here is the solution: change /etc/nginx/conf.d/domain.d/wordpress.conf and and this :
location /.well-known/ {
return 301 https://$server_name/YourSubFolder/$request_uri;
}
(https://github.com/pfefferle/wordpress-activitypub/issues/37#issuecomment-490521400)
For the record, upgrading wordpress via Yunohost remove the changes in Nginx file (they are backups in /home/yunohost.conf/backup/etc/nginx/conf.d/domain.tld.conf/wordpress.conf.backupDATE).
I've seen this error again today, with Wordpress Health check saying that the WebFinger endpoint is not accessible, and it not replying with a valid JSON. Indeed, it gets SSOed.
Adding the previously mentioned (https://github.com/YunoHost-Apps/wordpress_ynh/issues/61#issuecomment-490521823) Nginx conf lines fixed it. I'll make a PR.