is the 504 Gateway timeout period configurable?

4,087 views
Skip to first unread message

peter...@gmail.com

unread,
Aug 12, 2016, 11:56:36 AM8/12/16
to Kong

Hello Kong gurus,

Is there any way to configure the amount of time before Kong replies with a 504 on a per API basis? for the entire server? 

I tried editing these values in kong.yml, they were all set to 60s

  # Timeouts

  keepalive_timeout 120s;

  client_header_timeout 120s;

  client_body_timeout 120s;

  send_timeout 120s;


but after doing this and restarting Kong it still replies with a 504 after 60 seconds if the backing process has not responded.


Ideally this could be set at the API level - we have a process running on Windows that sometimes takes over a minute to respond and Kong is returning 504s which causes the client to error out even though the process completes successfully. Is there a plugin that supports this type of configuration?


Thanks!


Thibault Charbonnier

unread,
Aug 12, 2016, 3:22:52 PM8/12/16
to kong...@googlegroups.com
Have you tried setting 'proxy_read_timeout'?

See the ngx_http_proxy_module documentation since it is the way Kong currently communicates with your upstream services:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html

Best,
Thibault
--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com.
To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.
To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/dcdd0e04-b6cf-4301-8fc3-7086cdb0db1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Fierro

unread,
Aug 18, 2016, 11:07:00 AM8/18/16
to Thibault Charbonnier, kong...@googlegroups.com
Thanks very much Thibault.  

I added this in the # Proxy the request section of the kong.yml and it did the trick:   proxy_read_timeout 180s;

On Fri, Aug 12, 2016 at 2:22 PM, Thibault Charbonnier <thib...@mashape.com> wrote:
Have you tried setting 'proxy_read_timeout'?

See the ngx_http_proxy_module documentation since it is the way Kong currently communicates with your upstream services:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html

Best,
Thibault

On 8/12/16 8:56 AM, peter...@gmail.com wrote:

Hello Kong gurus,

Is there any way to configure the amount of time before Kong replies with a 504 on a per API basis? for the entire server? 

I tried editing these values in kong.yml, they were all set to 60s

  # Timeouts

  keepalive_timeout 120s;

  client_header_timeout 120s;

  client_body_timeout 120s;

  send_timeout 120s;


but after doing this and restarting Kong it still replies with a 504 after 60 seconds if the backing process has not responded.


Ideally this could be set at the API level - we have a process running on Windows that sometimes takes over a minute to respond and Kong is returning 504s which causes the client to error out even though the process completes successfully. Is there a plugin that supports this type of configuration?


Thanks!


--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Kong" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/konglayer/h1FbAoAQfmQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to konglayer+unsubscribe@googlegroups.com.

To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.

risha...@gmail.com

unread,
Apr 19, 2017, 5:08:38 PM4/19/17
to Kong
for kong 10.x use 
"upstream_connect_timeout": 60000,
"upstream_read_timeout": 28800000,
"upstream_send_timeout": 28800000
in post request 

Thibault Charbonnier

unread,
Apr 19, 2017, 10:19:48 PM4/19/17
to kong...@googlegroups.com
Hi,

Starting with Kong 0.10.0, you can use the new properties on the API Objects that are:

    upstream_connect_timeout
    upstream_read_timeout
    upstream_send_timeout

You can read more about these in the Proxy Guide:

    https://getkong.org/docs/0.10.x/proxy/#3-proxying-upstream-timeouts

Thibault
Reply all
Reply to author
Forward
0 new messages