title: How to set timeout in Kong v1.1.2
body: <p><strong>Problem</strong></p>
  
  <p>I am getting an error message in my Kong error log reporting that the upstream server has timed out. But I know that the upstream process was just taking over a minute, and when it completes (after Kong has logged the error) it logs a java error "Broken Pipe", implying that Kong was no longer listening for the response.</p>
  
  <p>This is the behavior when the upstream process takes longer than 60 seconds. In some cases, it takes less than 60 seconds and everything works correctly.</p>
  
  <p><strong>How can I extend Kong's timeout?</strong></p>
  
  <p><strong>Details</strong></p>
  
  <p>Kong Version</p>
  
  <pre><code>1.1.2
  </code></pre>
  
  <p>Kong's Error Message (slightly edited):</p>
  
  <pre><code>2019/12/06 09:57:10 [error] 1421#0: *1377 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xyz.xyz.xyz.xyz, server: kong, request: "POST /api/...... HTTP/1.1", upstream: "http://127.0.0.1:8010/api/.....", host: "xyz.xyz.com"
  </code></pre>
  
  <p>Here is the error from the upstream server log (Java / Tomcat via SpringBoot)</p>
  
  <pre><code>Dec 06 09:57:23 gateway-gw001-99 java[319]: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
  Dec 06 09:57:23 gateway-gw001-99 java[319]:         at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:364) ~[tomcat-embed-core-8.5.42.jar!/
  Dec 06 09:57:23 gateway-gw001-99 java[319]:         at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:833) ~[tomcat-embed-core-8.5.42.jar!
  ...
  </code></pre>
  
  <p>My kong.conf (slightly edited)</p>
  
  <pre><code>trusted_ips = 0.0.0.0/0
  admin_listen = 0.0.0.0:8001
  proxy_listen = 0.0.0.0:8080 proxy_protocol,  0.0.0.0:8443 ssl proxy_protocol
  database = postgres
  pg_host = 127.0.0.1
  pg_port = 5432
  pg_user = kong
  pg_password = xyzxyzxyzxyzxyz
  pg_database = kong
  plugins = bundled,session
  real_ip_header = proxy_protocol
  </code></pre>
  
  <p><strong>A little more Context</strong></p>
  
  <ul>
  <li>Kong and the Upstream Server are hosted on the same Ubuntu VM</li>
  <li>The Ubuntu VM is hosted as a linux container (LXC) inside another Ubuntu VM</li>
  <li>The outer VM uses NGinX to receive public traffic and reverse proxies it to Kong. It does this using stream. This allows Kong to be my SSL demarcation point.</li>
  </ul>
  
  <p>The Outer NGinX Stream Config:</p>
  
  <pre><code>stream {
  
      server {
          listen 80;
          proxy_pass xyz.xyz.xyz.xyz:8080;
          proxy_protocol on;
      }
  
      server {
          listen 443;
          proxy_pass xyz.xyz.xyz.xyz:8443;
          proxy_protocol on;
      }
  }
  </code></pre>
  
  <p><strong>What I've Tried</strong></p>
  
  <p>I've tried adding the following lines to kong.conf. In version 1.1.2 of Kong you basically alter the NGinX settings remotely by adding prefixes to NginX config and placing them in the kong.conf (<a href="https://docs.konghq.com/1.1.x/configuration/#injecting-individual-nginx-directives" rel="nofollow noreferrer">https://docs.konghq.com/1.1.x/configuration/#injecting-individual-nginx-directives</a> ). None of them seemed to do anything:</p>
  
  <pre><code>nginx_http_keepalive_timeout=300s
  nginx_proxy_proxy_read_timeout=300s
  nginx_http_proxy_read_timeout=300s
  nginx_proxy_send_timeout=300s
  nginx_http_send_timeout=300s
  </code></pre>