Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog in a subpath / webfinger test fails #37

Closed
lapineige opened this issue Mar 7, 2019 · 39 comments
Closed

Blog in a subpath / webfinger test fails #37

lapineige opened this issue Mar 7, 2019 · 39 comments

Comments

@lapineige
Copy link

My wordpress is installed in domain.tld/subpath.
When I try to test the webfinger part, it fails. With both [email protected] ("invalid content-type: text/html") and [email protected]/subdomain (<- this one gives me an encoding error "invalid URL escape "%2F"").

Is this plugin compatible with subpath ?

@pfefferle
Copy link
Member

WebFinger does not support subdirectories, so you have to create a .htaccess file in your root and forward the request to your blog directory.

@lapineige
Copy link
Author

And for Nginx ? What rule should I use ?

@celesteh
Copy link
Contributor

celesteh commented Apr 24, 2019

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

@lapineige
Copy link
Author

How can I use that rule with Nginx ?

@lapineige
Copy link
Author

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

@lapineige
Copy link
Author

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 ?

@pfefferle
Copy link
Member

exactly!

@lapineige
Copy link
Author

He doesn't work, same error, text/html content :(

@lapineige
Copy link
Author

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.

@pfefferle
Copy link
Member

Can you give me your identifier?

@lapineige
Copy link
Author

lapineige commented May 8, 2019

Search for [removed]

@pfefferle
Copy link
Member

Two things:

@lapineige
Copy link
Author

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.

@pfefferle
Copy link
Member

But what/who is redirecting your profile pages?

@lapineige
Copy link
Author

I don't know…

@lapineige
Copy link
Author

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…

@pfefferle
Copy link
Member

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

@lapineige
Copy link
Author

Done, same result.

@lapineige
Copy link
Author

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.

@lapineige
Copy link
Author

lapineige commented Jun 5, 2019

Ok, in fact a wordpress upgrade changed my nginx config (I use it with Yunohost).
I fixed that.
It works 🙂 - 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 🎉

@celesteh
Copy link
Contributor

celesteh commented Jun 5, 2019

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.

@lapineige
Copy link
Author

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.

@pfefferle
Copy link
Member

If you can also write an English version I can add it to the faq section of the readme...

@lapineige
Copy link
Author

That's an idea… I will see if I have some time to do it, then I'll give you the link :)

@lapineige
Copy link
Author

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…

@pfefferle
Copy link
Member

The URL you have to check is https://domain.tld/.well-known/webfinger?resource=acct:[email protected]

@pfefferle
Copy link
Member

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

@pfefferle
Copy link
Member

Here a working example: https://notiz.blog/.well-known/webfinger?resource=acct:[email protected]

@lapineige
Copy link
Author

lapineige commented Apr 28, 2020

@lapineige
Copy link
Author

For my domain, I have a 400 bad request and {"code":"activitypub_unsupported_resource","message":"Resource is invalid","data":{"status":400}}

@lapineige
Copy link
Author

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

@lapineige
Copy link
Author

Ok now instead of using https://$server_name/YourSubFolder/$request_uri; (YunoHost-Apps/wordpress_ynh#61 (comment)) I replaced $server_name with the actual domain.tld, and now https://domain.tld/.well-known/webfinger?resource=acct:[email protected] works.
But I can't see my article on mastodon.

@pfefferle
Copy link
Member

Can you post some real URLs, so I can check them?

@pfefferle
Copy link
Member

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?

@lapineige
Copy link
Author

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…

@pfefferle
Copy link
Member

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.

@lapineige
Copy link
Author

lapineige commented Apr 28, 2020

It works for me too from Mastodon.


EditorsKit and Stackable, that I used to add more blocks, are not in the pagebuilder category, right ?

@lapineige
Copy link
Author

lapineige commented Apr 28, 2020

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

@pfefferle
Copy link
Member

😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants