Nginx configuration to support HTTP/3

388 views Asked by At

I am trying to configure HTTP/3 for my site https://jscoder.io. I have installed Nginx v1.25 on the server, and the conf file is:

root@localhost:~# cat /etc/nginx/conf.d/jscoder.io.conf 
server {
    listen 443 quic reuseport;
    listen 443 ssl;
    server_name jscoder.io;
    ssl_certificate /root/jscoder_io.crt;
    ssl_certificate_key /root/jscoder-ssl.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    quic_retry on;
    ssl_early_data on;

    location / {
        add_header Alt-Svc 'h3=":$server_port"; ma=86400';
        add_header X-protocol $server_protocol always;
        add_header Strict-Transport-Security max-age=15768000;
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}

Now https://http3check.net/?host=https%3A%2F%2Fjscoder.io indicates that HTTP/3 is enabled. My local macOS FireFox also indicates H3. Moreover, If I visit the H3 testing page https://quic.nginx.org/, it serves me H3. But macOS Chrome (v119) and Safari still saying HTTP/1.1 (on the dev tools Network tab).

I have enable the quic feature on Chrome and restarted browser. But no luck:

https://files.slack.com/files-pri/T01HSMSV622-F0677UC5RSM/image.png

According to https://stackoverflow.com/a/71277536/978320:

Since HTTP/3 is still a relatively new protocol, browser may first use HTTP/1 or HTTP/2 when connecting to a server. The server may advertise support of HTTP/3 for subsequent connections. However, even after several requests, the browser may end up using HTTP/2 and TCP if QUIC handshake is delayed for some reason.

Maybe it's because I need to configure Nginx to enforce HTTP/3 for all requests?

0

There are 0 answers