525 SSL Error after Cloudflare Proxy kills the websocket connection. #2795

Closed
opened 2026-04-25 00:10:44 +02:00 by adam · 3 comments
Owner

Originally created by @tristanlarson on GitHub (May 24, 2025).

What happened?

When hosting Audiobookshelf behind Cloudflare Proxy, I kept getting 525 SSL Errors after leaving the tab and coming back to it.
I'm pretty sure Cloudflare is killing the websocket connection after a 100 second timeout then somehow mistaking it for an SSL error.

What did you expect to happen?

I thought it'd work properly.

Steps to reproduce the issue

  1. Host Audiobookshelf
  2. Put it behind Cloudflare Proxy
  3. Open it in your browser
  4. Wait > 100 seconds

Audiobookshelf version

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

None

Logs

{"msg":"upstream roundtrip", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket", "status":101, "headers":{"Upgrade":["websocket"]}}
{"msg":"upgrading connection", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket"}
{"msg":"streaming error", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket"}
{"msg":"connection closed", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket", "duration":130.87799589}

Additional Notes

I set up a Cloudflared tunnel to get around this issue and it's working fine.
There seems to be some way of keep the connection alive discussed here:
https://stackoverflow.com/questions/39668410/whats-disconnecting-my-websocket-connection-cloudflare-apaches-mod-proxy

Either way though you guys should put this in the documentation.
Sorry if I documented this wrong or if I put it in the wrong area, I've never done this kind of thing before.

Originally created by @tristanlarson on GitHub (May 24, 2025). ### What happened? When hosting Audiobookshelf behind Cloudflare Proxy, I kept getting 525 SSL Errors after leaving the tab and coming back to it. I'm pretty sure Cloudflare is killing the websocket connection after a 100 second timeout then somehow mistaking it for an SSL error. ### What did you expect to happen? I thought it'd work properly. ### Steps to reproduce the issue 1. Host Audiobookshelf 2. Put it behind Cloudflare Proxy 3. Open it in your browser 4. Wait > 100 seconds ### Audiobookshelf version 2.23.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? None ### Logs ```shell {"msg":"upstream roundtrip", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket", "status":101, "headers":{"Upgrade":["websocket"]}} {"msg":"upgrading connection", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket"} {"msg":"streaming error", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket"} {"msg":"connection closed", "uri":"/audiobookshelf/socket.io/?EIO=4&transport=websocket", "duration":130.87799589} ``` ### Additional Notes I set up a Cloudflared tunnel to get around this issue and it's working fine. There seems to be some way of keep the connection alive discussed here: https://stackoverflow.com/questions/39668410/whats-disconnecting-my-websocket-connection-cloudflare-apaches-mod-proxy Either way though you guys should put this in the documentation. Sorry if I documented this wrong or if I put it in the wrong area, I've never done this kind of thing before.
adam added the bug label 2026-04-25 00:10:44 +02:00
adam closed this issue 2026-04-25 00:10:44 +02:00
Author
Owner

@advplyr commented on GitHub (May 24, 2025):

I'm not sure what needs to be fixed? The web socket connection will continue to try reconnecting and reconnect when it is able to again

@advplyr commented on GitHub (May 24, 2025): I'm not sure what needs to be fixed? The web socket connection will continue to try reconnecting and reconnect when it is able to again
Author
Owner

@tristanlarson commented on GitHub (May 25, 2025):

I'm not sure what needs to be fixed? The web socket connection will continue to try reconnecting and reconnect when it is able to again

Something in the process of killing the websocket connection and then reconnecting makes Cloudflare infer a 525 error, and so instead of reconnecting you get a 525 error page from Cloudflare. That page continues showing up for a while so you can't get back to the server until Cloudflare realizes there's no SSL error.

@tristanlarson commented on GitHub (May 25, 2025): > I'm not sure what needs to be fixed? The web socket connection will continue to try reconnecting and reconnect when it is able to again Something in the process of killing the websocket connection and then reconnecting makes Cloudflare infer a 525 error, and so instead of reconnecting you get a 525 error page from Cloudflare. That page continues showing up for a while so you can't get back to the server until Cloudflare realizes there's no SSL error.
Author
Owner

@tristanlarson commented on GitHub (May 25, 2025):

Sorry, I know there's not much to do and it's really all about Cloudflare, but it'd be cool if you added this issue to the docs or made some other sort of acknowledgement of it. Really just the issue being here solved would be good for people who encounter this in the future. The whole troubleshooting process was confusing for this one because of the misleading CF error, so I just thought it'd be good for something to be here.

@tristanlarson commented on GitHub (May 25, 2025): Sorry, I know there's not much to do and it's really all about Cloudflare, but it'd be cool if you added this issue to the docs or made some other sort of acknowledgement of it. Really just the issue being here solved would be good for people who encounter this in the future. The whole troubleshooting process was confusing for this one because of the misleading CF error, so I just thought it'd be good for something to be here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2795