2023 Answer:
Most browsers now support the use of a new DNS record type, HTTPS
, to connect with HTTP/3 directly, without an initial connection on an older protocol. This is an improvement over the Alt-Svc
header method because it (from the spec):
enables many of the benefits of Alt-Svc without waiting for a full HTTP connection initiation (multiple roundtrips) before learning of the preferred alternative, and without necessarily revealing the user's intended destination to all entities along the network path.
A website can advertise it supports HTTP/3 by use of a DNS zone file entry as follows:
example.com. 3600 IN HTTPS 1 . alpn="h3"
More info:
Note that, despite mainstream browser support, the HTTPS record is still in draft, and many hosts won't let you put an HTTPS record type in the zone file. You'll probably need to use one of the bigger DNS providers, such as Google Cloud DNS, AWS, Cloudflare etc., or your own DNS server.
If you want to verify your HTTPS record, dig
won't do it (at least in the version I have). Instead, you can use the drill
tool that comes with ldns.
For example, google.com has this HTTPS record:
(0) > drill google.com HTTPS
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 25201
;; flags: qr rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; google.com. IN HTTPS
;; ANSWER SECTION:
google.com. 544 IN HTTPS 1 . alpn=h2,h3
;; AUTHORITY SECTION:
;; ADDITIONAL SECTION:
;; Query time: 18 msec
;; SERVER: 8.8.8.8
;; WHEN: Thu Nov 2 11:33:02 2023
;; MSG SIZE rcvd: 53