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

If you cannot find yourself with Mastodon client / WebFinger problems - a working hack #188

Closed
j0uni opened this issue Nov 19, 2022 · 13 comments
Labels
[Status] wontfix This will not be worked on

Comments

@j0uni
Copy link

j0uni commented Nov 19, 2022

If you are struggling to be found with Mastodon etc search, you probably have the WebFinger working incorrectly.

First of all I couldn't get WebFinger working with just installing this plugin. I ended up creating the .well-known/webfinger file manually in my web root directory. If you have only one user account that is writing to your WordPress, it is probably not worth the trouble to fight with ReWrite or such, just create the file manually.

The file should look something like this:

{
    "subject": "jouni@YOURDOMAIN",
    "aliases": [
        "https://YOURDOMAIN/author/jouni/"
    ],
    "links": [
        {
            "rel": "self",
            "type": "application/activity+json",
            "href": "https://YOURDOMAIN/author/jouni/"
        },
        {
            "rel": "http://webfinger.net/rel/profile-page",
            "type": "text/html",
            "href": "https://YOURDOMAIN/author/jouni/"
        }
    ]
}

The most important part is the href of "application/activity+json". How do you get that?

First of all remember that the correct URL for this is depend on the permalink settings on Wordpress. So configure your permalinks to what you want before next step.

You get the correct content for your WebFinger from this URL: https://YOURDOMAIN/?rest_route=/activitypub/1.0/webfinger&resource=acct:jouni@YOURDOMAIN - just copy paste the output of this to your fixed webfinger file at .well-known.

After this you should be fine and get things running.

Remember that this is a hack but it works. If you change your permalink settings or account name you probably need to fix your webfinger. You can render your site un-foundable quite easily so please remember checking that your webfinger is working after changes to WP config.

@pfefferle
Copy link
Member

Thanks for this really creative workaround! 😊

@pfefferle pfefferle added the [Status] wontfix This will not be worked on label Nov 21, 2022
@stale stale bot closed this as completed Nov 28, 2022
@punkrockgirl
Copy link

Hi,

If my WordPress blog is hosted on a subdomain, where is the webfinger supposed to go: domain.com's .well-known folder, or blog.domain.com's one?

I've tried both and I still get that my

WebFinger endpoint does not return valid JSON for application/jrd+json

My blog is hosted on Dreamhost (shared plan) and before trying this I went with the redirect: RedirectMatch "^\/\.well-known(.*)$" "\/blog\/\.well-known$1" The result is the same: Error getting JRD: 400 Bad Request

@timnolte
Copy link

@punkrockgirl the problem is Dreamhost with Let's Encrypt. With that hosting there is a real folder that contains the SSL certificate verification endpoint. You have to use the .htaccess details provided elsewhere in this issue.

@pfefferle
Copy link
Member

@punkrockgirl it is supposed to use the subdomain. You should see how the WebFinger resource should look like on the welcome page. If you try to check this resource on https://webfinger.net , it shows you how the URL has to look like: https://blog.domain.com/.well-known/webfinger?resource=acct:username@blog.domain.com

...and what @timnolte says!

@punkrockgirl
Copy link

Thanks,

Well, I tried subdomain and root, but it didn't fix anything. When visiting the url, I get missing "resource" parameter. I have since deleted the webfinger files (that I created manually).

I'm checking this issue now and done two quick tests:

  • url.domain.ltd/wp-json/activitypub/1.0/webfinger: {"code":"rest_missing_callback_param","message":"resource parameter is missing","data":{"status":400,"params":["resource"]}}
  • url.domain.ltd/.well-known/webfinger: 404 (forbidden.html)

I haven't used WordPress in 5 years so I'm really rusty. I'm going to read everything properly once I finish upgrading Nextcloud.

@danielstucke
Copy link

Thank you so much for this!

@echoleaf
Copy link

If this doesn't work, is there an alternative? I'm guessing something changed on my server as activitypub was working on a site, and it's not now.

@macstainless
Copy link

Commenting to say this worked and resolved my lingering Webfinger issue. THANK YOU!!!

@MindCreatesMeaning
Copy link

This worked for me when nothing else even came close!! (July 2023)

@spudart
Copy link

spudart commented Jan 20, 2024

When creating WebFinger file manually, what do I name the file? Just "webfinger"? Is there an extension I should use?

@pfefferle
Copy link
Member

@spudart it has to be accessible through /.well-known/webfinger so if you do it a simple textfile, it has to be without the extension. If you want to write a php file that proxies the requests, it could be /.well-known/webfinger/index.php (but I am not sure if PHP will be interpreted in the .well-known folder).

@tobiasgraywrites
Copy link

tobiasgraywrites commented Feb 27, 2024

My apologies for posting on a 'closed' issue but I didn't see anything more relevant that might be able to help us out. We've implemented the above 'workaround' and still haven't seen anything show up on Mastodon (I figure it will take some time, anyway) so I'm content to wait but I was also wondering if there was an example configuration of how to do to this for multiple authors or if it would be best for the @blog@example.com blog profile rather than trying to map it for individual authors. Thank you for your time!

Edit: I failed to mention that this works wonderfully and as expected on other fediverse applications such as Misskey/Sharkey and other WordPress blogs which I find to be interesting. Too bad Mastodon seems to still have the lion's share or this wouldn't be much of an issue lol

Edit 2: Using the format https://(DOMAIN NAME)/@(USERNAME) in the hrefs field of the above code worked for the blog profile, still not sure how to implement this for all authors as I've not much experience with webfinger yet.

@j0uni
Copy link
Author

j0uni commented Feb 27, 2024

My apologies for posting on a 'closed' issue but I didn't see anything more relevant that might be able to help us out. We've implemented the above 'workaround' and still haven't seen anything show up on Mastodon (I figure it will take some time, anyway) so I'm content to wait but I was also wondering if there was an example configuration of how to do to this for multiple authors or if it would be best for the @blog@example.com blog profile rather than trying to map it for individual authors. Thank you for your time!

Edit: I failed to mention that this works wonderfully and as expected on other fediverse applications such as Misskey/Sharkey and other WordPress blogs which I find to be interesting. Too bad Mastodon seems to still have the lion's share or this wouldn't be much of an issue lol

Edit 2: Using the format https://(DOMAIN NAME)/@(USERNAME) in the hrefs field of the above code worked for the blog profile, still not sure how to implement this for all authors as I've not much experience with webfinger yet.

You need to edit the webfinger file manually for all the authors manually. It should work then if you just enter information correctly.

I actually managed to get this plugin working some weeks ago without any hacks. I didn't do that much any trickery, just basic .htaccess and stuff but I would recommend try to get things working "naturally" as it makes this pretty smooth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

10 participants