Hi all,
We added/configured an API in Tyk. We noticed that if the response body is greater than a certain value (around 30MB) it already throws a 502 Gateway Error. However, when we call the API directly (not thru Tyk), we are receiving the response just fine. I was wondering if there is any configuration we need to do and what is the default max response body size configuration.
We already made the configurations per this document:
https://tyk.io/docs/troubleshooting/tyk-gateway/502-error-tyk-gateway/#description
but we’re still encountering the issue.
Thanks in advance.
Olu
April 29, 2022, 10:14am
2
Hi @mcabrera , I will have to reproduce this and get back to you
Olu
April 29, 2022, 1:09pm
3
I tried with a 36MB JSON file and that worked fine. Do you mind sharing the gateway version, gateway config, headers and file type (binary or otherwise) you are using?
You can share it on the thread or send me a private message if you wish
Hi @Olu ,
I’ve sent you a private message.
Thank you!
Olu
May 17, 2022, 2:16pm
5
Thanks for sharing the info. I sent you a private message a couple of days ago but haven’t gotten your response. I’ll post it again here in case it becomes useful in future.
I used the same gateway version (3.2) and config file (with a few tweaks) and could not reproduce the issue. Can you also share the API definition file?
One more thing that could be useful is the gateway logs in debug mode. You can enable it via the environment variables TYK_GW_LOGLEVEL=debug
. I have dropped a sample of what we might be looking for in the debug logs. The logs below shows the start of the API call till the end.
time="May 03 03:20:06" level=debug msg=Started api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=VersionCheck org_id= origin=192.168.208.1 path="/large-json-file/" ts=1651548006106790200
time="May 03 03:20:06" level=debug msg=Finished api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" code=200 mw=VersionCheck ns=199200 org_id= origin=192.168.208.1 path="/large-json-file/"
time="May 03 03:20:06" level=debug msg=Started api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=RateCheckMW org_id= origin=192.168.208.1 path="/large-json-file/" ts=1651548006107302300
time="May 03 03:20:06" level=debug msg=Finished api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" code=200 mw=RateCheckMW ns=553700 org_id= origin=192.168.208.1 path="/large-json-file/"
time="May 03 03:20:06" level=debug msg="Started proxy"
time="May 03 03:20:06" level=debug msg="Stripping: /large-json-file/"
time="May 03 03:20:06" level=debug msg="Upstream Path is: "
time="May 03 03:20:06" level=debug msg=Started api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy org_id= ts=1651548006108004700
time="May 03 03:20:06" level=debug msg="Upstream request URL: " api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy org_id=
time="May 03 03:20:06" level=debug msg="Outbound request URL: http://eadc-102-67-1-37.ngrok.io" api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy org_id=
time="May 03 03:20:06" level=debug msg="Creating new transport" api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy org_id=
time="May 03 03:20:06" level=debug msg="Out request url: http://eadc-102-67-1-37.ngrok.io" api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy org_id=
time="May 03 03:20:09" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:20:19" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:20:29" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:20:39" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:20:49" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:20:59" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:09" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:19" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:29" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:39" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:49" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:21:59" level=debug msg="Primary instance set, I am master" prefix=host-check-mgr
time="May 03 03:22:07" level=debug msg=Finished api_id=ojx6u1btp5c9mir2ahw7nqz0v4 api_name="Localhost HTTP Bin" mw=ReverseProxy ns=121112814800 org_id=
time="May 03 03:22:07" level=debug msg="Upstream request took (ms): 121112.9574"
time="May 03 03:22:07" level=debug msg="Adding Healthcheck to: ojx6u1btp5c9mir2ahw7nqz0v4.Request"
time="May 03 03:22:07" level=debug msg="Val is: 121112"
time="May 03 03:22:07" level=debug msg="Set value to: 1651548127220949700.121112"
time="May 03 03:22:07" level=debug msg="Done proxy"
bls
February 23, 2024, 10:08pm
6
Hi, on this topic, is there any maximum response body size that the gateway can handle?
Olu
February 26, 2024, 9:19am
7
Last I checked, I tested with almost a gigabyte file size of response and it still handled it. Would you mind sharing the issue you are experiencing?