#120 Endless "OPTIONS" requests with Friendica

Open
opened 2 years ago by heluecht · 6 comments
heluecht commented 2 years ago

Friendica, a software for the fediverse just like Pleroma or Mastodon recently introduced a Mastodon compatible API. Most mobile clients and several desktop clients are working like a charm.

Halcyon doesn't work at the moment. Registration does work, but afterwards it seems to perform an endless stream of OPTIONS requests without displaying any content.

Surely Friendica is to blame for that, we seem to have forgotten something. Is there any place in the code where I can see what the system expects - or do you have got an idea where the problem could be?

Thanks!

Friendica, a software for the fediverse just like Pleroma or Mastodon recently introduced a Mastodon compatible API. Most mobile clients and several desktop clients are working like a charm. Halcyon doesn't work at the moment. Registration does work, but afterwards it seems to perform an endless stream of `OPTIONS` requests without displaying any content. Surely Friendica is to blame for that, we seem to have forgotten something. Is there any place in the code where I can see what the system expects - or do you have got an idea where the problem could be? Thanks!
Niklas Poslovski commented 2 years ago
Owner

That's difficult to tell without trying myself.
Can you recommend any Friendica instance which already supports the Mastodon API so that I can try it out?
And could you please tell me exactly which API endpoint it tries to call and what the response is?
Do other Webclients like Pinafore work with Friendica?
If not,it's most likely related to missing/messed up CORS headers - that was already a problem with Pleroma in it's early days.

That's difficult to tell without trying myself. Can you recommend any Friendica instance which already supports the Mastodon API so that I can try it out? And could you please tell me exactly which API endpoint it tries to call and what the response is? Do other Webclients like Pinafore work with Friendica? If not,it's most likely related to missing/messed up CORS headers - that was already a problem with Pleroma in it's early days.
heluecht commented 2 years ago
Poster

You could try squeet.me, this is running on the latest release candidate. Pinafore doesn't work either, so it is most likely that CORS is responsible for this, I guess. I haven't worked that much with it, so it would be great if you would know some documentation which headers are needed, so that Halycon does work.

You could try squeet.me, this is running on the latest release candidate. Pinafore doesn't work either, so it is most likely that CORS is responsible for this, I guess. I haven't worked that much with it, so it would be great if you would know some documentation which headers are needed, so that Halycon does work.
Niklas Poslovski commented 2 years ago
Owner

I did now verify the issue with a squeet.me account and it's really due to missing CORS headers.
Have a look at how Mastodon does it: https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
Maybe this can help you to implement it in Friendica.
Alternatively, it should be possible to set it with your .htaccess or Nginx/lighttpd config but it's much better to use header() functions in Friendica directly to make sure that there won't be problems with instances where the admins don't update their webserver configuration.
I remember heavy problems with Pleroma when it was only in the Nginx example...

I did now verify the issue with a squeet.me account and it's really due to missing CORS headers. Have a look at how Mastodon does it: https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb Maybe this can help you to implement it in Friendica. Alternatively, it should be possible to set it with your .htaccess or Nginx/lighttpd config but it's **much** better to use header() functions in Friendica directly to make sure that there won't be problems with instances where the admins don't update their webserver configuration. I remember heavy problems with Pleroma when it was only in the Nginx example...
heluecht commented 2 years ago
Poster

Thanks, that helped a lot! I applied the changes at my test instance and most stuff seems to work now. Currently the trending tags just show an endless spinner. I guess that Halcyon expects more than we provide there, so I have to check.

Thanks, that helped a lot! I applied the changes at my test instance and most stuff seems to work now. Currently the trending tags just show an endless spinner. I guess that Halcyon expects more than we provide there, so I have to check.
Niklas Poslovski commented 2 years ago
Owner

The trending tags show up correctly with my test account on your instance.
The only big issue I see with the API is that the /api/v1/streaming Websocket Endpoint is missing.
That means Halcyon won't display notifications at all and new content only after the page is reloaded.
I know that Websockets are quite difficult to implement in PHP but the real-time features are a important part of the Mastodon API that should be implemented sooner or later.

The trending tags show up correctly with my test account on your instance. The only big issue I see with the API is that the /api/v1/streaming Websocket Endpoint is missing. That means Halcyon won't display notifications at all and new content only after the page is reloaded. I know that Websockets are quite difficult to implement in PHP but the real-time features are a important part of the Mastodon API that should be implemented sooner or later.
heluecht commented 2 years ago
Poster

Shortly after my post I realised that Halcyon is using some content from the trending tags that we hadn't provided, so I changed that.

Yes, the streaming is currently unsupported. We have to check how to implement this. It could be difficult, since Friendica is designed to run on shared hosters as well where you have got shell access but no administrative permissions.

Shortly after my post I realised that Halcyon is using some content from the trending tags that we hadn't provided, so I changed that. Yes, the streaming is currently unsupported. We have to check how to implement this. It could be difficult, since Friendica is designed to run on shared hosters as well where you have got shell access but no administrative permissions.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.