-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Websockets keep disconnecting #1562
Comments
Hello @geekgonecrazy, thank you for your report! You need to extend the default timeouts or disable them
It is really important to read our release notes (https://github.com/mholt/caddy/releases/tag/v0.9.5) P.S.: "default timeouts are going to be disabled in the next version (they already are on master)" Matt H. |
@elcore ah I remember seeing this now. Might want to consider adding to notes that this effects websockets too. I realize its just an upgraded http request, but still would help make this clearer. Thanks for the quick response 👍 |
Thank you very much @geekgonecrazy!!!
"[...] timeouts apply to an entire HTTP server which may serve multiple sites defined in your Caddyfile, the timeout values for each site will be reduced to their minimum values (with 0, or disabled, being the lowest) across all sites that share that server." |
@geekgonecrazy The next release of Caddy will not have default timeouts. |
@elcore thanks for the link to docs. I definitely understand the need for timeouts. Waiting around for too long is just wasting resources. No complaints for helping me save resources I went ahead and disabled timeouts on mine. But.. Per defaults I'm still unsure which would be effecting my websockets. Read: 10s - this being a websocket is it expecting to handle all frames regardless in this amount of time before hanging up? Since the request is upgraded and happens in less then this.. I would assume does not apply. @mholt I assume this is because of tickets like mine. Is there a ticket you have discussed remove vs improve defaults? Would be curious as to the decision. I know most other web server / proxies have defaults. So this definitely isn't new to have them. Usually we only hit them when we are doing very edge case scenarios like servers that take too long to respond etc. Thanks again for the responses guys! We love caddy over on the Rocket.Chat project. Our users love it too. |
@geekgonecrazy Glad to hear, thank you. :) Default timeouts were removed in part because, yes, issues of confusion (partly my fault for documentation fails, but it was very clear in the release notes) - despite the security benefits. Go doesn't let us customize timeouts per-request (yet, there are issues about it so maybe for 1.9 or 1.10) and since we lose that kind of flexibility, maybe best to turn them off by default. At least for now. I didn't realize Rocket.Chat had docs for using it with Caddy. That's cool. Is there a reason this section is in your docs? https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/autossl#redirecting-http-to-https - Caddy does this for you automatically, no need to manually create a redirect (unless you are redirecting differently than Caddy does). (To answer your question about which limits cause the disconnect, Idle doesn't apply until Go 1.8, which Caddy 0.9.5 is not built on, but the next version will be. I'm guessing you're hitting the Read or Write timeouts. I'm not actually sure which.) |
Ah! Ok that makes sense. Only done basic rest API's in go, generally leveraging gin never going that low.. So was unaware of that limitation.
We use it in our snaps trying to make it simple to get full setup going. So simplicity of caddy fit right in
I think that was oversight. Came from nginx where such verbose syntax is required. 😁 I'll update and simplify! Thanks! |
1. What version of Caddy are you running (
caddy -version
)?0.9.5
2. What are you trying to do?
Reverse proxy in front of an application with websockets
3. What is your entire Caddyfile?
4. How did you run Caddy (give the full command and describe the execution environment)?
Command:
sudo sh -c "ulimit -n 65535 && sudo /usr/local/bin/caddy -agree -log=stdout -conf=/etc/caddy/Caddyfile"
OS:
5. Please paste any relevant HTTP request(s) here.
Was seeing this output frequently:
6. What did you expect to see?
7. What did you see instead (give full error messages and/or log)?
Websockets would disconnect about every 3-4 seconds indefinetely. Not matter how many times I restarted it.
8. How can someone who is starting from scratch reproduce the bug as minimally as possible?
My setup is: caddy with the above config which reverse proxy to a docker container running rocket.chat.
You'll see the connection banner flash every few seconds, if you open the dev console on browser you'll see the socket drop and come back every few seconds.
If I downgrade to 0.9.4 it works fine.
The text was updated successfully, but these errors were encountered: