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

[Bug]: Websocket issue #3913

Open
alternativesurfer opened this issue Jan 29, 2025 · 10 comments
Open

[Bug]: Websocket issue #3913

alternativesurfer opened this issue Jan 29, 2025 · 10 comments
Labels
bug Something isn't working unable to reproduce Issue is not yet reproducible waiting Waiting for OP

Comments

@alternativesurfer
Copy link

What happened?

Issue #3868 was taken over by Synology users and the base problem was never reviewed.

I do not use Synology, just running Docker on an ubuntu server.
This seems unrelated to the Synology people since I never lost access to my front end.

This was working previously on 2.17.3 without error.
I was out of town so didn't patch between then and 2.18.0.

I am running through HAProxy. No config change on that end.
The only thing failing is the Socket error. I am able to load the GUI and playback items.

Direct to IP also works, but with the same socket error.

Something definitely changed, because previously there were no websocket issues when I used HAProxy (not Apache).

Now my console is filled with these errors:
Image

Timing wise, I suspect this is what broke it: #3754
I added the env flag: EXP_PROXY_SUPPORT=1 to test, still not working.

So, I believe whatever fix was put into place for that issue broke proxy support for those of us it was already working for.

What did you expect to happen?

The websocket connects.

Steps to reproduce the issue

  1. Launch app.
  2. error exists

Audiobookshelf version

v2.18.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Other (list in "Additional Notes" box)

Logs

The only thing I can see related to the websocket is: 
2025-01-20 20:52:05.099

DEBUG

[SocketAuthority] clientEmitter - no clients found for user 06835809-8b6a-47fe-81fd-1677b1ddf6c6

Additional Notes

UI errors:
Edge
Firefox (windows)
Fennec (Android)

as well as the Android Audiobookshelf App & Lissen app.

@alternativesurfer alternativesurfer added the bug Something isn't working label Jan 29, 2025
@nichwall
Copy link
Contributor

2.18.0 added a forced subdirectory of audiobookshelf/. If you are already using a subdomain, the web client redirects to the subdirectory, but everything is still accessible using the subdomain paths. Does HAProxy handle subdirectories differently?

@mikiher
Copy link
Contributor

mikiher commented Jan 30, 2025

Can you please share your HAProxy setup?

@alternativesurfer
Copy link
Author

Can you please share your HAProxy setup?

Config attached:
haproxy (1).txt

Looks like it doesn't include my real servers info:
name: jc-audiobookshelf
type: static
IP: 192.168.20.56
port: 80

@alternativesurfer
Copy link
Author

2.18.0 added a forced subdirectory of audiobookshelf/. If you are already using a subdomain, the web client redirects to the subdirectory, but everything is still accessible using the subdomain paths. Does HAProxy handle subdirectories differently?

Not to my knowledge.
It does properly route to the backend server with the client redirecting to the subdirectory:

Image

However, the websocket always fails to connect:

Image

@nichwall
Copy link
Contributor

Throwing the config at chatgpt says there is an issue with the http-server-close because that closes connections instead of allowing the websocket to remain open. I am not familiar with HAProxy configuration, but I don't see anything in your config about upgrading to a websocket connection.

@alternativesurfer
Copy link
Author

Yeah, I've been through many iterations trying to resolve this.
The original config did not have http-server-close, it only had:
option forwardfor

HAProxy does not require extra tooling to support websockets. It detects the initial header (or API) and switches from hhttp to websocket.

The only changes needed are to edit timeout rules to ensure the server doesn't cut them too soon.
timeout client 50000ms
timeout connect 5000ms
timeout server 50000ms

For the sake of troubleshooting this in my original working config, I have removed all additional backend options except for forwardfor.
Tested, same result.

@nichwall
Copy link
Contributor

Can you share the original config that is not working?

@mikiher
Copy link
Contributor

mikiher commented Jan 30, 2025

Just to make sure: you have redacted the config, replacing your domain with EXAMPLE, right?

Can you also share a screenshot of the status code, as well as the request and response headers for the wss request (in Edge developer tools, Network tab, select WS in the filter line, and click on the request line)

@advplyr
Copy link
Owner

advplyr commented Feb 4, 2025

Are you still working on this?

@advplyr advplyr added waiting Waiting for OP unable to reproduce Issue is not yet reproducible labels Feb 4, 2025
@mikiher
Copy link
Contributor

mikiher commented Feb 5, 2025

I asked a question and am waiting for a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unable to reproduce Issue is not yet reproducible waiting Waiting for OP
Projects
None yet
Development

No branches or pull requests

4 participants