title: How to find out why Nginx return 400 while use it as http/2 load balancer?
body: <p>I'm implementing a http/2 proxy myself, and I'm using Nginx as load balancer.</p>
  
  <p>When I use Nginx as h2c load balancer, it works:</p>
  
  <pre><code>server {
      listen 8443 http2;
  
      location / {
          error_log /Users/jiajun/nginx_error_log.log debug;
          grpc_pass grpc://127.0.0.1:2017;
      }
  }
  </code></pre>
  
  <p>Run it:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ go run example/grpc_client/main.go
  calling to 127.0.0.1:2019
  2019/01/28 11:50:46 gonna call c.SayHello...
  2019/01/28 11:50:46 Greeting: Hello world
  </code></pre>
  
  <p>And Nginx access log is:</p>
  
  <pre><code>127.0.0.1 - - [28/Jan/2019:11:50:46 +0800] "POST /helloworld.Greeter/SayHello HTTP/2.0" 200 18 "-" "grpc-go/1.16.0" "-"
  </code></pre>
  
  <hr>
  
  <p>But it does not work while I'm serving it under SSL:</p>
  
  <pre><code>server {
      listen 8443 ssl http2;
      ssl_certificate     /Users/jiajun/127.0.0.1.crt;
      ssl_certificate_key /Users/jiajun/127.0.0.1.key;
  
      location / {
          error_log /Users/jiajun/nginx_error_log.log debug;
          grpc_pass grpc://127.0.0.1:2017;
      }
  }
  </code></pre>
  
  <p>Run it:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ go run example/grpc_client/main.go
  calling to 127.0.0.1:2019
  2019/01/28 11:53:06 gonna call c.SayHello...
  2019/01/28 11:53:06 could not greet: rpc error: code = Unavailable desc = transport is closing
  exit status 1
  </code></pre>
  
  <p>And, Nginx access log is:</p>
  
  <pre><code>127.0.0.1 - - [28/Jan/2019:11:53:06 +0800] "PRI * HTTP/2.0" 400 157 "-" "-" "-"
  </code></pre>
  
  <hr>
  
  <p>So I'm trying to find out why it return a 400 while I'm using SSL. But Nginx does not record the process in error log even I've set log level to debug(and it had compiled with <code>--with-debug</code> option).</p>
  
  <p>Is there any good idea to debug it?</p>