title: Getting 504 timeout error in a GRPC call under Nginx web server
body: <p>I am using a unary RPC method. I have a server that I have configured under the Nginx web server. Following is the Nginx configuration:</p>
  <pre><code>server {
          listen 80 http2;
          server_name test.grpc.tester.local;
  
  
          access_log /var/log/nginx/test.grpc.tester.local.access.log;
          error_log /var/log/nginx/test.grpc.tester.local.error.log;
  
          location / {
              grpc_pass grpc://localhost:8001;
          }
  }
  </code></pre>
  <p>I have a client that is also available in the same host machine. I have called this unary method in couple of ways and I have following observation:</p>
  <ol>
  <li><p>If I call the server RPC method using the Nginx proxy (<strong>test.grpc.tester.local:80</strong>) and if it takes more than 1 minutes then I get errors:</p>
  <ul>
  <li><p>in error logs of Nginx:
  <code>upstream timed out (110: Connection timed out) while reading response header from upstream</code></p>
  </li>
  <li><p>in the client log: <code>Error: 1 CANCELLED: Received http2 header with status: 504</code>.</p>
  </li>
  </ul>
  </li>
  <li><p>If I don't use the Nginx and directly access using <strong>localhost:8001</strong>, it never gives the error (even server takes more than 1 minute) and gives success status.</p>
  </li>
  </ol>
  <p>My query over here is that how can I increase the request time, so I won't get the timeout error. I have tried these following configs but no luck:</p>
  <pre><code>    proxy_connect_timeout  600s;
      proxy_send_timeout  600s;
      proxy_read_timeout  600s;
      fastcgi_send_timeout 600s;
      fastcgi_read_timeout 600s;
  </code></pre>
  <p>Can anyone guide me on how can I resolve this issue?</p>
  <p>Thank you.</p>