mendhak / docker-http-https-echo

Docker image that echoes request data as JSON; listens on HTTP/S, useful for debugging.
https://code.mendhak.com/docker-http-https-echo/
MIT License
621 stars 136 forks source link

Could this server accept http2? #36

Open Rainton opened 2 years ago

Rainton commented 2 years ago

It looks like http2 is not supported, do you have any plan to add this feature?

yutongli@yutongli:~$ curl -k https://localhost:8443 -v --http2
*   Trying 127.0.0.1:8443...
* Connected to localhost (127.0.0.1) port 8443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=Utah; L=Provo; O=ACME Tech Inc; CN=my.example.com
*  start date: Nov 23 07:59:02 2021 GMT
*  expire date: Apr  9 07:59:02 2049 GMT
*  issuer: C=US; ST=Utah; L=Provo; O=ACME Signing Authority Inc; CN=example.com
*  SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
> GET / HTTP/1.1
> Host: localhost:8443
> User-Agent: curl/7.79.1
> Accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
mendhak commented 2 years ago

No plans but that would be nice, maybe even include HTTP3 if it's simple. But I'm not seeing a straightforward solution.

It looks like Express doesn't support HTTP2 : https://github.com/expressjs/compression/issues/122 and there's an ongoing/stalled pull request for its implementation: https://github.com/expressjs/express/pull/3730

I see some mentions of 'spdy', but that is not compatible with Node 16: https://github.com/spdy-http2/node-spdy/issues/380