POST over HTTP/2 geeft error door Nginx
Weer een obscure issue waar verder nooit iemand tegenaan gaat lopen, dus kijk maar of jullie er iets mee willen.
Sinds een lokale curl-upgrade ging het draaien van deze snippet ineens stuk. Blijkbaar gaat het mis wanneer een POST
-request over HTTP/2
verstuurd wordt. Minimum working example:
$ curl -V
curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.54.0 OpenSSL/1.1.0e zlib/1.2.11 libpsl/0.17.0 (+libicu/59.1) libssh2/1.8.0 nghttp2/1.22.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
$ curl -v --data "something=something" "https://thalia.nu/"
* Trying 131.174.31.8...
* TCP_NODELAY set
* Connected to thalia.nu (131.174.31.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP2 (h2)
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=thalia.nu
* start date: Mar 25 22:05:00 2017 GMT
* expire date: Jun 23 22:05:00 2017 GMT
* subjectAltName: host "thalia.nu" matched cert's "thalia.nu"
* issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
* SSL certificate verify ok.
* 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=0
* Using Stream ID: 1 (easy handle 0x16c1120)
> POST / HTTP/2
> Host: thalia.nu
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 19
> Content-Type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* HTTP/2 stream 1 was not closed cleanly: REFUSED_STREAM (err 7)
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):
curl: (92) HTTP/2 stream 1 was not closed cleanly: REFUSED_STREAM (err 7)
Een HTTP/2
GET
of elke HTTP/1.1
-request werkt wel gewoon zoals verwacht. Het blijkt een bekende bug in Nginx 1.10.x (en nog wat versies, gefixt in 1.11.5?) te zijn. In Dokku hebben ze HTTP/2
daarom maar uitgezet voor deze Nginx-versies. Vanuit Firefox verbind ik trouwens gewoon met HTTP/1.1
, dus dit lijkt een non-issue te zijn voor normale gebruikers...