jwt-proxy doesn't work with SSE (Server Side Events) #15942
Labels
kind/bug
Outline of a bug - must adhere to the bug report template.
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
severity/P1
Has a major impact to usage or development of the system.
I have added and deployed some extra plugins for theia. One of those plugins uses SSE (Server Side Events) events to get notifications. However that did work locally but not after deploying this to our cluster.
I figured out that the problem for me was the jwt-proxy:
SSE works such, that the server writes a few lines to a long-polling HTTP GET whenever it wants to notify the client. However the jwt-proxy will not flush these lines and therefore they will get buffered until the buffer used by io.copy is used is full (which seems to be in the range of 8-16KB which equals to a lot of messages...)
For testing I used a simple SSE Server (like this: https://jasonbutz.info/2018/08/server-sent-events-with-node/) which sents a message every second to subscribers.
If I try to connect to this source behind the jwt-proxy, it will return the messages as bunch, which makes it quite pointless.
I would suggest to handle SSE with an explicit Flush, e.g. like that in
proxy.go
:The FlushWriter would just overwrite "write" and call a flush afterwards:
With these modifications the simple SSE example properly returns one message per second.
The text was updated successfully, but these errors were encountered: