Score:1

Can I listen to multiple domains in one ip on HTTP/3?

cn flag

I'm using NGINX. I found that NGINX throws error when I set multiple domains for one HTTP/3 port.

    server {
        listen 443 http3 reuseport;
        listen 443 ssl http2;
        server_name FIRST_DOMAIN;
        ssl_certificate     /etc/letsencrypt-ecdsa/live/FIRST_DOMAIN/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt-ecdsa/live/FIRST_DOMAIN/privkey.pem;
        ssl_protocols       TLSv1.3;

        return 301 https://SECOND_DOMAIN$request_uri;
    }

    server {
        listen 443 http3 reuseport;
        listen 443 ssl http2;
        server_name SECOND_DOMAIN default;
        ssl_certificate     /etc/letsencrypt-ecdsa/live/SECOND_DOMAIN/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt-ecdsa/live/SECOND_DOMAIN/privkey.pem;
        ssl_protocols       TLSv1.3;

        add_header Alt-Svc 'h3=":443"; ma=86400';

        location / {
            proxy_pass http://host.docker.internal:10002/;
            proxy_set_header  Host              $http_host;
            proxy_set_header  X-Real-IP         $remote_addr;
            proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header  X-Forwarded-Proto $scheme;
        }
    }
nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /etc/nginx/nginx.conf:35

Can I listen to multiple domains in one ip on HTTP/3?

KaMZaTa avatar
us flag
Did you solve? I’ve got the same issue
Score:0
cn flag
const express = require('express');

const app = express();

app.get('/', (req, res) => {
    res.send(req.hostname);
});

app.listen(40000);

I experimented about it with Node.js express. When I use HTTP/2, hostname printed. But when I use HTTP/3, undefined printed. This shows that HTTP/3 doesn't care about hostname. So, Listening to multiple domains in one HTTP/3 port is impossible. But you can open several ports for each HTTP/3 domains and add Alt-Svc header for advertise them to browser.

But according to my experience, Alt-Svc doesn't works stable depending on browser. So, you can't listen to multiple domains in one ip on HTTP/3 stably.

ng flag
are you sure about this : you can't listen to multiple domains in one ip on HTTP/3
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.