title: Is Nginx support http/2 upgrade from http/1.1 in clear text(h2c)
body: <p>Is there any way to support http1.1 upgrade to h2c (not in ssl) in nginx?</p>
  
  <p>use curl test site <a href="http://nghttp2.org/" rel="nofollow noreferrer">http://nghttp2.org/</a> </p>
  
  <pre><code>$ curl --http2  http://nghttp2.org/ -s -o /dev/null -v
  </code></pre>
  
  <p>I get the following result:</p>
  
  <pre><code>*   Trying 139.162.123.134...
  * TCP_NODELAY set
  * Connected to nghttp2.org (139.162.123.134) port 80 (#0)
  &gt; GET / HTTP/1.1
  &gt; Host: nghttp2.org
  &gt; User-Agent: curl/7.54.0
  &gt; Accept: */*
  &gt; Connection: Upgrade, HTTP2-Settings
  &gt; Upgrade: h2c
  &gt; HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
  &gt;
  &lt; HTTP/1.1 101 Switching Protocols
  &lt; Connection: Upgrade
  &lt; Upgrade: h2c
  * Received 101
  * Using HTTP2, server supports multi-use
  * Connection state changed (HTTP/2 confirmed)
  * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=33
  * Connection state changed (MAX_CONCURRENT_STREAMS updated)!
  &lt; HTTP/2 200
  &lt; date: Fri, 24 May 2019 08:58:43 GMT
  &lt; content-type: text/html
  &lt; last-modified: Thu, 18 Apr 2019 06:19:33 GMT
  &lt; etag: "5cb816f5-19d8"
  &lt; accept-ranges: bytes
  &lt; content-length: 6616
  &lt; x-backend-header-rtt: 0.009521
  &lt; server: nghttpx
  &lt; via: 2 nghttpx
  &lt; x-frame-options: SAMEORIGIN
  &lt; x-xss-protection: 1; mode=block
  &lt; x-content-type-options: nosniff
  &lt;
  { [2159 bytes data]
  * Connection #0 to host nghttp2.org left intact
  </code></pre>
  
  <p>but when I access a nginx static website , it will fail.</p>
  
  <pre><code>$ curl --http2 -v 10.10.5.89:9006
  * Rebuilt URL to: 10.10.5.89:9006/
  *   Trying 10.10.5.89...
  * TCP_NODELAY set
  * Connected to 10.10.5.89 (10.10.5.89) port 9006 (#0)
  &gt; GET / HTTP/1.1
  &gt; Host: 10.10.5.89:9006
  &gt; User-Agent: curl/7.54.0
  &gt; Accept: */*
  &gt; Connection: Upgrade, HTTP2-Settings
  &gt; Upgrade: h2c
  &gt; HTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA
  &gt;
  * Connection #0 to host 10.10.5.89 left intact
  $
  </code></pre>
  
  <p>here is my nginx conf</p>
  
  <pre><code>
  server {
      listen 9006 http2 fastopen=3 reuseport;
  
      location / {
          autoindex_exact_size off;
          root /www/;
          autoindex on;
          }        
      }
  }
  
  </code></pre>
  
  <p>nginx debug info:</p>
  
  <pre><code>2019/05/24 16:49:53 [debug] 348#348: *1 invalid http2 connection preface "GET / HTTP/1.1
  "
  2019/05/24 16:49:53 [debug] 348#348: *1 http2 state connection error
  2019/05/24 16:49:53 [debug] 348#348: *1 http2 send GOAWAY frame: last sid 0, error 1
  2019/05/24 16:49:53 [debug] 348#348: *1 http2 frame out: 0000561508B48B08 sid:0 bl:0 len:8
  2019/05/24 16:49:53 [debug] 348#348: *1 http2 frame out: 0000561508B48A58 sid:0 bl:0 len:4
  2019/05/24 16:49:53 [debug] 348#348: *1 http2 frame out: 0000561508B489A0 sid:0 bl:0 len:18
  </code></pre>