You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
if upstream of the reverse proxy is a sse enabled/streaming server, tyk should be providing data back as soon as it receives it, whats happening instead is "tyk not providing any response until either it reaches the timeout or the connections is closed upstream". So basically buffering until it can.
With that piece which disables the caching, the streaming works correctly.
The downside with that solution (besides usage of a specific header), is that if the TYK_GW_ANALYTICSCONFIG_ENABLEDETAILEDRECORDING is true, the tyk will panic out on
Branch/Environment/Version
Describe the bug
if upstream of the reverse proxy is a sse enabled/streaming server, tyk should be providing data back as soon as it receives it, whats happening instead is "tyk not providing any response until either it reaches the timeout or the connections is closed upstream". So basically buffering until it can.
Reproduction steps
Given following app
and this tyk conf
any calls to
/sse/
will result in no response being received in realtime.Additional context
Upon the investigation I found the issue (but I do not have enough familiarity with the project to attempt a proper resolution).
when request arrives at this point
tyk/gateway/reverse_proxy.go
Lines 1446 to 1465 in 0d1183c
the flow will enter correctly in the
if flushInterval != 0 {
block (due to being recognised heretyk/gateway/reverse_proxy.go
Lines 1428 to 1436 in 0d1183c
if wf, ok := dst.(writeFlusher); ok {
will fail, and it won't enter inside.The reason for this can be traced here:
tyk/gateway/reverse_proxy.go
Lines 1337 to 1341 in 0d1183c
If the cache is enabled, then the
dst
is going to be abytes.Buffer
and won't satisfy the required interface.As a workaround I've changed
tyk/gateway/reverse_proxy.go
Lines 517 to 521 in 0d1183c
into
With that piece which disables the caching, the streaming works correctly.
The downside with that solution (besides usage of a specific header), is that if the
TYK_GW_ANALYTICSCONFIG_ENABLEDETAILEDRECORDING
is true, the tyk will panic out ontyk/gateway/handler_success.go
Line 227 in 0d1183c
responseCopy.Body
will be nil (it has been already dumped earlier during the streaming).The text was updated successfully, but these errors were encountered: