Proxy read timeout can be exceeded by notifications using web sockets
Web socket connections may hit the proxy read timeout limit set by a proxy server. In that case, the client will receive no notifications once the connection is dropped.
Expected Behavior
The client should consistently receive notifications even when the application is behind a proxy server
Current Behavior
When the read timeout is reached, the client stops to receive notifications on the backend
Possible Solution
The connection is closed if the proxied server does not transmit any data between the timeout period. The proxied server can send websocket ping frames to reset the timeout.
Known Workarounds
Use fallback notifications
Steps to Reproduce (for bugs)
- Login into the backend and verify the events connections is made through ws
- Generate a notification (e.g. reindex) in less than the read timeout value to verify is notifying properly
- Wait until the timeout is reached and try again
Context
Running dotCMS behind a proxy server
Your Environment
- dotCMS version used: 4.0.1 (dist)
- Browser Name and version: Chrome
- Operating System and version: Linux
- Java Brand and version: OpenJDK 1.8.0_121-b13
I think from the config perspective we can try to see if the timeout and keepalive helps. In our side, we will implement a Ping/Pong strategy; I consider by default is should be turn off and can be turn on by configuration.
we have implemented a ping/pong strategy to keep connections websockets alive @john-thomas-dotcms these are the configuration variables important to document
dotcms.websocket.usepingpong=true dotcms.websocket.millis.pingpong=10000
usepingpong in true (by default false, but it can change) means the ping pong strategy works on dotcms, by default dotCMS do not use pingpong
millis.pingpong is the time to wait for send the ping message (in milli seconds), it could be a better strategy to use half of the seconds you have for timeout.
PR: https://github.com/dotCMS/core/pull/11422
Doc: https://auth.dotcms.com/docs/latest/authentication-using-jwt#Proxy
PR: https://github.com/dotCMS/core/pull/11598 https://github.com/dotCMS/core/pull/11649
Internal report: https://my.dotcms.com/tickets/detail.dot?id=47b202ac-c1c0-4f25-bc8a-35cc84ea1f3e
Fixed, tested by @vianneychacon in cloud environment and seems that now is working better