oathkeeper icon indicating copy to clipboard operation
oathkeeper copied to clipboard

SSE writes are ignored by timeout settings

Open andrewbanchich opened this issue 3 years ago • 3 comments
trafficstars

Preflight checklist

Describe the bug

serve.proxy.timeout.write will close server-sent event connections, even if they are using keep-alives.

Reproducing the bug

  1. Create server with SSE endpoint and keep-alives sent every 15 seconds.
  2. On the frontend, use the JS EventSource API to connect and process messages.
  3. The browser console should display an error after Oathkeeper's timeout setting (120s by default) saying the connection was closed.

Relevant log output

No response

Relevant configuration

No response

Version

0.38.15-beta.1

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Docker

Additional Context

No response

andrewbanchich avatar Nov 19 '21 14:11 andrewbanchich

Hm yeah I think Oathkeeper really struggles with SSE. I think one option is to increase the timeout values. However, it will still close at some point.

Maybe we could implement keep alive somehow?

aeneasr avatar Nov 28 '21 10:11 aeneasr

Yeah, having keep-alive would be ideal and allow Oathkeeper to differentiate between a working SSE connection and one that needs to be closed.

andrewbanchich avatar Nov 28 '21 12:11 andrewbanchich

Maybe it is possible to simply suspend the timeout if the content type is "text/event-stream".

andlinger avatar Dec 04 '22 12:12 andlinger