Closed lapineige closed 5 years ago
WebFinger does not support subdirectories, so you have to create a .htaccess
file in your root and forward the request to your blog directory.
And for Nginx ? What rule should I use ?
WebFinger does not support subdirectories, so you have to create a
.htaccess
file in your root and forward the request to your blog directory.
This is the .htaccess file that worked for me. "blog" is the name of the subdirectory. You would need to use your own instead:
RedirectMatch "^\/\.well-known(.*)$" "\/blog\/\.well-known$1"
It would be super if this could be documented somewhere within the plugin, such as the faq
How can I use that rule with Nginx ?
I tried with rewrite ^/.well-known/ ^/subdirectory/.well-known/ last;
.
It doesn't work. I have this error (using https://client.webfinger.net/lookup) invalid content-type: text/html
.
And it tries to connect to : https://domain.tld/.well-known/webfinger?resource=acct%3Ablog%40domain.tld
I'm wondering : I tried to do that change in nginx config file for my wordpress, not for the root domain. But I need to change the root domain, right ? So when webfinger tries to access domain.tld/.well_known, it redirects to domain.tld/blog/.well_known ?
exactly!
He doesn't work, same error, text/html content :(
Ok I fixed this problem: I was due to Yunohost SSO, which were blocking any public access to this file.
Now the redirection is working.
Here is the solution:
location /.well-known/ {
return 301 https://$server_name/YourSubFolder/$request_uri;
}
https://client.webfinger.net shows the json.
But I still can't see my blog from Mastodon.
Can you give me your identifier?
Search for [removed]
Two things:
You are redirecting your profile URLs https://lapineige.fr/wp/blog/author/lapineige/ to the main URL, but they are required for ActivityPub! Perhaps you use YoastSEO?
Uh… that's not on purpose… No I don't use this plugin.
I am not sure if mastodon supports http redirects
It works for Nextcloud.
But what/who is redirecting your profile pages?
I don't know…
Ok I found the plugin (NinjaFirewall) that was changing the default behaviour.
But now the WebFinger tool gives me a 403 forbidden (as before my rewrite). But if I try to connect to the URL it tries to reach, the redirection is working…
Can you try to refresh the permalinks of your blog? go to the permalinks page and simply press the save button... you do not have to change anything...
Done, same result.
So here is the current status: the redirect works on the browser. With curl
, it shows a 301. With curl -L
it follows the redirect and I have a 403.
Ok, in fact a wordpress upgrade changed my nginx config (I use it with Yunohost). I fixed that. It works :slightly_smiling_face: - even if I can't see the blog posts (the number is correct on the profile) but I guess it needs time to federate.
Problem solved, thanks a lot :tada:
Hi, I appreciate that you don't want to keep issues open when the solution is known, but has this actually been documented any place else but in these issues?
I'd do a pull request, but it doesn't seem like the README is the best location and other help files are not immediately obvious.
Well I didn't want to spam again @pfefferle with my problems ^^
I don't know where to put this, I'm actually writing a blog post (in French) to talk about this plugin, but my problem was kind of specific and I don't know if it's a good idea to explain the solutions in a place where it's hard to find, while here in the issues it's kind of easier to found it.
If you can also write an English version I can add it to the faq section of the readme...
That's an idea… I will see if I have some time to do it, then I'll give you the link :)
After sometimes, I discovered that my nginx config changed, and I'm not sure I kept the previous one.
I tried to reconfigure it, with
location /.well-known/ {
return 301 https://$server_name/subfolder/$request_uri;
}
But it doesn't work from Mastodon and https://webfinger.net/lookup/ gives me this:
Error getting JRD: 400 Bad Request
A curl https://domain.tld/.well-known
gives a 301 Moved Permanently, which is normal (it should redirect to https://domain.tld/subfolder/.well-known
).
But a curl -L https://domain.tld/.well-known/
gives a 404, a curl -L https://domain.tld/.well-known/webfinger
a :
{"code":"rest_missing_callback_param","message":"Missing parameter: resource","data":{"status":400,"params":["resource"]}
And curl -L https://domain.tld/subfolder/blog/author/pseudo/
a :
{"code":"activitypub_unsupported_resource","message":"Resource is invalid","data":{"status":400}}
I'm lost, I don't remember which URL I should test, and how to configure Nginx…
The URL you have to check is https://domain.tld/.well-known/webfinger?resource=acct:username@domain.tld
{"code":"rest_missing_callback_param","message":"Missing parameter: resource","data":{"status":400,"params":["resource"]}
This error is correct! It says, that your rewrite seems to work, but you pass no resource param.
Here a working example: https://notiz.blog/.well-known/webfinger?resource=acct:pfefferle@notiz.blog
https://webfinger.net/lookup/?resource=https%3A%2F%2Fnotiz.blog%2F.well-known%2Fwebfinger%3Fresource%3Dacct%3Apfefferle%40notiz.blog 404 not found 😅
edit: curl gives the right result
For my domain, I have a 400 bad request and {"code":"activitypub_unsupported_resource","message":"Resource is invalid","data":{"status":400}}
If I try with an article from my wordpress (the last one, that doesn't appear on mastodon): 422 Validation failed : text can't be blank
Ok now instead of using https://$server_name/YourSubFolder/$request_uri;
(https://github.com/YunoHost-Apps/wordpress_ynh/issues/61#issuecomment-490521823) I replaced $server_name with the actual domain.tld
, and now https://domain.tld/.well-known/webfinger?resource=acct:username@domain.tld
works.
But I can't see my article on mastodon.
Can you post some real URLs, so I can check them?
Is it the URL from your GitHub profile? If so, it does return the JSON response but without content.
Request:
curl "https://lapineige.fr/wp/blog/2020/04/retour-dexperience-sur-le-format-dimage-webp-un-excellent-rapport-qualite-poids/" \
-H 'Accept: application/activity+json'
Response:
{
"@context": [
"https:\/\/www.w3.org\/ns\/activitystreams",
"https:\/\/w3id.org\/security\/v1",
{
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"PropertyValue": "schema:PropertyValue",
"schema": "http:\/\/schema.org#",
"value": "schema:value"
}
],
"id": "https:\/\/lapineige.fr\/wp\/blog\/2020\/04\/retour-dexperience-sur-le-format-dimage-webp-un-excellent-rapport-qualite-poids\/",
"type": "Note",
"published": "2020-04-28T16:15:58Z",
"attributedTo": "https:\/\/lapineige.fr\/wp\/blog\/author\/lapineige\/",
"summary": null,
"inReplyTo": null,
"content": null,
"contentMap": {
"fr": null
},
"to": [
"https:\/\/www.w3.org\/ns\/activitystreams#Public"
],
"cc": [
"https:\/\/www.w3.org\/ns\/activitystreams#Public"
],
"attachment": [],
"tag": []
}
Do you use a pagebuilder or a multi language plugin?
Thank you. I don't think I use any pagebuilder, and I don't use a multi-language plugin… It was working a few months ago, I didn't test it in the mid-time…
Hmmm... I just tested it with my site and it seems to work properly:
curl "https://notiz.blog/2020/03/15/i-am-a-human-of-wordpress/" \
-H 'Accept: application/activity+json'
Also when I search for the URL on mastodon.
It works for me too from Mastodon.
EditorsKit and Stackable, that I used to add more blocks, are not in the pagebuilder category, right ?
Ooooook that's super weird: I tried to change Activity-Object-Type (I changed a random parameter), saved it, then disabled an enabled again the extension, and while curl still fails, I can see it with the URL on Mastodon… And I have the tittle and a link, which is the format I always wanted… but couldn't have for some reason.
Thanks a lot for your help :)
:blush:
My wordpress is installed in domain.tld/subpath. When I try to test the webfinger part, it fails. With both username@domain.tld ("invalid content-type: text/html") and username@domain.tld/subdomain (<- this one gives me an encoding error "invalid URL escape "%2F"").
Is this plugin compatible with subpath ?