Nginx files upload streaming with tyk gateway

Hi,
We are using tyk gateway in our application. We have a problem in file upload that tyk gateway waits for the whole file body to be uploaded before passing it to the upstream. This causes problems for me, because I want to track upload progress at my application. Any idea how to configure tyk in order to stream file body in real time to the upstream

Something like proxy_request_buffering in nginx.

Thanks

Hi @Selvakumar_P and welcome to the community.

You can set a header:

Content-Type: text/event-stream

which will engage streaming mode at the gateway. this is meant primarily for SSE so may not work in your specific case.

thanks, G.

@Gregor
I have tried, But no luck.

I have tried along with flush interval config. But still it not working
https://tyk.io/docs/tyk-oss-gateway/configuration/#http_server_optionsflush_interval

Hi @Selvakumar_P,

Did you try setting close_connection to false? I haven’t tried it but this Github issue has a good discussion about the premise.

Yes, I had tried that as well. But It didn’t work

I am going to have to try and reproduce this. Could you give a couple of days to try and get back to you?

Did you get chance to try this out ?

Apologies for the delay. Realized I did not reply to you.

I did try it out with no luck. Consulted our engineering team and got feedback that file upload and streaming is different stuff.

flush_interval setting is for response body, file upload is a request process

The only thing we could propose for now, is a custom Go plugin, which forces Tyk to stream body to the upstream, instead of fully reading it. When you write response from within the Go plugin, it breaks middleware chain and does not run our standard proxy code Golang plugins.

Let me know if this helps?