Problems getting browser and curl to connect to HTTP/3 server #11417
Description
Jetty Version
12.0.7-SNAPSHOT using this PR: #11368
Jetty Environment
core
Java Version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Zulu21.30+15-CA (build 21.0.1+12-LTS, mixed mode, sharing)
Question
My server is accepting HTTP/1, HTTPS/1, HTTP/2, and HTTP/3 connections. I am able to connect Jetty's HttpClient to the server's HTTP/3 endpoint just fine, but Chrome and Curl don't work (for different reasons).
- Chrome hits the HTTPS/2 endpoint, gets a response containing
Alt-Svc: h3=":8443"; ma=60
but no matter what I do, it never tries hitting the HTTP/3 endpoint... even in subsequent page reloads. Wireshark confirms there is no activity on the UDP port.
If I configure Cloudflare to act as a HTTP/3 -> HTTP/2 tunnel then Chrome happily hits Cloudflare's HTTP/3 endpoint. I don't know what "trick" I'm missing to convince the browser to try hitting the HTTP/3 endpoint.
- If I run
curl --http3 --verbose https://licensed.app:8443/
I get:
* Host licensed.app:8443 was resolved.
* IPv6: 2607:f2c0:948a:ba00:29cb:e324:bf4d:ca98
* IPv4: 69.165.149.235
* Trying 69.165.149.235:8443...
* QUIC cipher selection: TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256
* CAfile: C:\util\curl\curl-ca-bundle.crt
* CApath: none
* Trying [2607:f2c0:948a:ba00:29cb:e324:bf4d:ca98]:8443...
* QUIC cipher selection: TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256
* Trying 69.165.149.235:8443...
* subjectAltName: host "licensed.app" matched cert's "licensed.app"
* Verified certificate just fine
* Connected to licensed.app (69.165.149.235) port 8443
* using HTTP/3
* [HTTP/3] [0] OPENED stream for https://licensed.app:8443/
* [HTTP/3] [0] [:method: GET]
* [HTTP/3] [0] [:scheme: https]
* [HTTP/3] [0] [:authority: licensed.app:8443]
* [HTTP/3] [0] [:path: /]
* [HTTP/3] [0] [user-agent: curl/8.6.0]
* [HTTP/3] [0] [accept: */*]
> GET / HTTP/3
> Host: licensed.app:8443
> User-Agent: curl/8.6.0
> Accept: */*
>
< HTTP/3 200
< server: Jetty(12.0.7-SNAPSHOT)
< date: Sat, 17 Feb 2024 20:56:59 GMT
< vary: Accept-Encoding
< alt-svc: h3=":8443"; ma=60
< vary: Accept
< cache-control: max-age=300
* HTTP/3 stream 0 reset by server
* Connection #0 to host licensed.app left intact
curl: (95) HTTP/3 stream 0 reset by server
From the server's perspective, I see my code running Sink.write(response, true, StandardCharsets.UTF_8.encode(body));
and when this method completes curl gets disconnected unexpectly. Here are the DEBUG logs from the server and the corresponding Wireshark capture:
server-logs-for-curl.txt
curl-wireshark.zip
So to recap, I've got two separate problems: one with Chrome and another with curl
. Let me know if you have any ideas for what I can try next.