What is HTTP/3 and how to enable it in Traefik?

One of the most recent developments is HTTP/3, a new version of the protocol that powers much of the web. In this post, we'll explore what HTTP/3 is, how it works, and how to enable it on your server.

What is HTTP/3 and how to enable it in Traefik?

The internet is a constantly changing space, and the protocols that power it are no exception. One of the most recent developments is HTTP/3, a new version of the protocol that powers much of the web. In this post, we'll explore what HTTP/3 is, how it works, and how to enable it on your server.

What is HTTP/3?

HTTP/3 was announced 5 years after the announcement of HTTP/2 in 2015. It is the third major version of the Hypertext Transfer Protocol. This version introduces several new features and performance enhancements compared to previous versions. The most notable change is the switch from TCP to QUIC. QUIC (Quick UDP Internet Connections) is designed to improve latency and throughput. It was developed by google in 2012. QUIC works by combining multiple connections into a single stream, which allows for faster data transfer and more reliable connections.

Google is one of the leading companies to promote and implement HTTP/3 and QUIC on its services, such as Gmail and YouTube. Other vendors, such as Cloudflare and Fastly, are also offering HTTP/3 to end users. According to Google, HTTP/3 can improve the performance of web services by 8 to 13%. HTTP/3 is mostly implemented on the edge layer for end users, as this is where the primary benefits of the protocol can be seen. This performance improvement is especially beneficial for SEO and mobile networks, as it can help speed up page loading times and decrease bandwidth usage. Currently, Chromium, Firefox, Opera, and Chrome all support HTTP/3.

How to enable HTTP/3 in Traefik?

The best way to enable HTTP/3 is through a CDN such as Cloudflare or Fastly. Alternatively, you can use Traefik to enable it yourself. However, HTTP/3 support in Traefik is still experimental and must be enabled manually. I have already explained how to setup Traefik with docker in this post:

Securing your blog with Traefik and LetsEncrypt | iThink
This post demonstrates how to use Traefik and LetsEncrypt to obtain a free TLS certificate. Traefik enables us to make the blog accessible securely on the public internet, even if it is running on a private network.

You can enable HTTP/3 in Traefik configuration with either YAML or TOML, like this:

experimental:
  http3: true

entryPoints:
  name:
    http3:
      advertisedPort: 443
[experimental]
  http3 = true

[entryPoints.name.http3]
  advertisedPort = 443

This configuration can also be set through Traefik CLI. If you have configured Traefik through docker-compose.yaml like in the post I mentioned before then you can extend the configuration like below.

...
traefik:
    image: "traefik:v2.9"
    container_name: "traefik"
    command:
      ...
      - "--experimental.http3=true"
      - "--entrypoints.name.http3.advertisedPort=443"
      ...
    ports:
      - "443:443"
      - "443:443/udp"
      - "80:80"
...

In addition to TCP ports, we also enable UDP port 443, as HTTP/3 only works with UDP. You may need to forward UDP port 443 in your router. Remember to restart Traefik to apply the changed configuration.

💡
HTTP/3 works with TLS, so make sure TLS is already configured in your Traefik configuration. For instructions on how to enable TLS in Traefik, see this post.

How to verify if HTTP/3 is enabled for your site?

You can verify if HTTP/3 is enabled by visiting this website:

HTTP/3 Test | Ensure Your Website’s Speed and Compatibility
Find out if your site supports the latest H3 protocol for better performance. Domsignal H3 tool use cURL for the testing

Verify HTTP/3 on Domsignal

Verifying if HTTP/3 is enabled for your site or not
Verifying if HTTP/3 is enabled for your site or not

Conclusion

HTTP/3 is the latest version of the Hypertext Transfer Protocol, and it introduces several new features and performance improvements over the previous versions. It is powered by QUIC, a protocol designed to reduce latency and increase throughput. This post explains how to enable HTTP/3 in Traefik.