YunoHost-Apps / wordpress_ynh

WordPress package for YunoHost
https://wordpress.org/
GNU General Public License v3.0
26 stars 30 forks source link

Using Activitypub plugin: how to configure the redirection ? #61

Open lapineige opened 5 years ago

lapineige commented 5 years ago

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 ?

maniackcrudelis commented 5 years ago

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"
lapineige commented 5 years ago

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.

maniackcrudelis commented 5 years ago

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.

lapineige commented 5 years ago

Ok thanks.

No problem, I was thinking that yunohost SSO could have been a problem.

lapineige commented 5 years ago

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".

lapineige commented 5 years ago

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)

lapineige commented 5 years ago

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).

lapineige commented 9 months ago

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.