HTTP/3 with multiple server blocks

Jonny Barnes jonnybarnes at gmail.com
Mon Nov 2 20:14:09 UTC 2020


Okay, progress, fyi for anyone adding HTTP/3 support, make sure your
server’s firewall has port 443 open for udp as well as tcp! :face_palm:

First server worked after opening the port

To get the second server I seemed to need to repeat myself slightly. I
needed:
>    listen 443 http3;
>    listen [::]:443 http3;
>
>    listen 443;
>    listen [::]:443;

Is this to get it to listen on both udp and tcp?

On Mon, 2 Nov 2020 at 20:00, Jonny Barnes <jonnybarnes at gmail.com> wrote:

> If I understand the link correctly, I want to only set options on the
> `default_server`.
>
> So I know have three vhosts setup, the first is a generic https redirector
> and looks like:
> >server {
> >    listen 80;
> >    listen [::]:80;
> >    return 301 https://$host$request_uri;
> >}
>
> The next starts:
> >server {
> >    listen 443 http3 default_server reuseport;
> >    listen [::]:443 http3 default_server reuseport;
> >
> >    listen 443 ssl http2;
> >    listen [::]:443 ssl http2;
> >
> >    server_name foo;
> >
> >    add_header Alt-Svc '$http3=":443"; ma=15';
>
> And the second:
> >server {
> >    listen 443;
> >    listen [::]:443;
> >
> >    server_name bar;
> >
> > add_header Alt-Svc '$http3=":443"; ma=15';
>
> The nginx config test passes, but everything is served over HTTP/2.
>
> Is there something obvious I’m missing here?
>
> On Mon, 2 Nov 2020 at 13:39, Sergey Kandaurov <pluknet at nginx.com> wrote:
>
>>
>> > On 30 Oct 2020, at 22:21, Jonny Barnes <jonnybarnes at gmail.com> wrote:
>> >
>> > Can we do this?
>> >
>> > First issue is if I add the line `listen 443 http3 resueport` to more
>> than one server {} block the nginx conf test gives the following error:
>> >
>> > > nginx: [emerg] duplicate listen options for 0.0.0.0:443 in
>> /usr/local/nginx/conf/sites-enabled/legolas:2
>> > > nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
>>
>> That's expected behaviour, see for detailed explanation:
>> https://trac.nginx.org/nginx/ticket/1912
>>
>> >
>> > It seemingly works if i only have it for one of my server blocks. But I
>> can‘t get my firefox browser to connect with HTTP/3. It does connect to
>> quic.nginx.org over HTTP/3.
>>
>> You may want to hint Firefox about QUIC protocol using Alt-Svc.
>>
>> --
>> Sergey Kandaurov
>>
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20201102/4bef702a/attachment-0001.htm>


More information about the nginx-devel mailing list