<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi,<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 26 Jun 2024, at 7:21 PM, Riccardo Brunetti Host <riccardo.brunetti@host.it> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Hello, thanks for the answer.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br><blockquote type="cite"><div>On 26 Jun 2024, at 16:45, Roman Arutyunyan <<a href="mailto:arut@nginx.com">arut@nginx.com</a>> wrote:</div><br class="Apple-interchange-newline"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi,<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 26 Jun 2024, at 6:15 PM, Riccardo Brunetti Host <<a href="mailto:riccardo.brunetti@host.it">riccardo.brunetti@host.it</a>> wrote:</div><br class="Apple-interchange-newline"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hello.<div><br></div><div>I have a Nginx server which acts as a reverse proxy for a given number of different domains and I’m trying to enable http3 for a subset of them.</div><div><br></div><div>I placed the directives:</div><div><br></div><div><blockquote type="cite"><div>    http3 on;</div><div>    listen xx.xx.xx.xx:443 default_server quic reuseport;</div><div>    quic_retry on;</div></blockquote><br></div><div>in the default.conf file and then, only for those domains which I want http3 enabled I also add in the corresponding virtual host:</div><div><br></div><div><blockquote type="cite"><div>        http3 on;</div><div>        listen xx.xx.xx.xx:443 quic;</div><div>        quic_retry on;</div></blockquote><div><br></div>In the server section and <br><br></div><div><blockquote type="cite"><pre style="padding: 0px; margin-top: 0px; margin-bottom: 0px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); text-decoration-thickness: initial;">add_header Alt-Svc 'h3=":8443"; ma=86400';</pre></blockquote><div><br></div></div><div>Inside the location.</div><div><br></div><div>Now, what happens is that if I try to open the sites *with* http3 enabled, everything works as expected. If I try to open a site *without* http3 enabled, sometimes I have an SSL error because the server returns the “default virtual host” certificate.</div><div>It seems related to the type of browser.</div><div><br></div><div>Is it an expected behaviour or I am doing something wrong with the server configuration?</div></div></div></blockquote><div><br></div><div>If you use http/3 to access a virtual server that does not support http/3, the default http/3 server will be used.<br></div><div><br></div><div>Make sure the above add_header does not affect the servers which do not support http/3.</div></div></div></div></blockquote><div><br></div><div>I add the header above only on the virtual hosts which I want to support http/3, thus it should not interfere with the other non http/3 domains.</div><div>Nevertheless, if I try with curl:</div><div><br></div><div>1) Site http/3 enabled:</div><div><br></div><div><blockquote type="cite"># curl --http3 -I -v https://<fqdn></blockquote><blockquote type="cite"><div>* Host <fqdn>t:443 was resolved.</div><div>* IPv6: (none)</div><div>* IPv4: <ip></div><div>* WARNING: no socket in pollset, transfer may stall!</div><div>*   Trying <ip>:443...</div><div>* Server certificate:</div><div>*  subject: CN=<fqdn></div><div>*  start date: May 14 07:39:37 2024 GMT</div><div>*  expire date: Aug 12 07:39:36 2024 GMT</div><div>*  subjectAltName: host “<fqdn>" matched cert's “<fqdn>"</div><div>*  issuer: C=US; O=Let's Encrypt; CN=R3</div><div>*  SSL certificate verify ok.</div><div>* Connected to <fqdn> (<ip>) port 443</div><div>* using HTTP/3</div><div>* [HTTP/3] [0] OPENED stream for https://<fqdn>/</div></blockquote>…</div><div>…</div><div><br></div><div>So it gets the correct certificate and it goes on using http/3</div><div><br></div><div>2) Site non http/3 enabled:</div><div><br></div><div><blockquote type="cite"># curl --http3 -I -v https://<fqdn></blockquote></div><div><blockquote type="cite"><div>* Host <fqdn>:443 was resolved.</div><div>* IPv6: (none)</div><div>* IPv4: <ip></div><div>* WARNING: no socket in pollset, transfer may stall!</div><div>*   Trying <ip>:443...</div></blockquote><blockquote type="cite"><div>* SSL certificate problem: unable to get local issuer certificate</div><div>* connect to <ip> port 443 failed: SSL peer certificate or SSH remote key was not OK</div></blockquote><blockquote type="cite"><div>* Failed to connect to<fqdn> port 443 after 33 ms: SSL peer certificate or SSH remote key was not OK</div></blockquote><blockquote type="cite"><div>*   Trying <ip>:443...</div></blockquote><blockquote type="cite"><div>* Connected to<fqdn> (<ip>) port 443</div></blockquote><blockquote type="cite"><div>* ALPN: curl offers h2,http/1.1</div><div>* TLSv1.2 (OUT), TLS handshake, Client hello (1):</div><div>* TLSv1.2 (IN), TLS handshake, Server hello (2):</div><div>* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):</div><div>* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):</div><div>* TLSv1.3 (IN), TLS handshake, Certificate (11):</div><div>* TLSv1.3 (IN), TLS handshake, CERT verify (15):</div><div>* TLSv1.3 (IN), TLS handshake, Finished (20):</div><div>* TLSv1.3 (OUT), TLS handshake, Finished (20):</div><div>* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / [blank] / UNDEF</div><div>* ALPN: server accepted h2</div><div>* Server certificate:</div><div>*  subject: CN=<fqdn></div></blockquote><blockquote type="cite"><div>*  start date: Apr 16 08:36:25 2024 GMT</div><div>*  expire date: Jul 15 08:36:24 2024 GMT</div><div>*  subjectAltName: host "<fqdn>" matched cert's "<fqdn>"</div></blockquote><blockquote type="cite"><div>*  issuer: C=US; O=Let's Encrypt; CN=R3</div><div>*  SSL certificate verify ok.</div><div>* using HTTP/2</div><div>* [HTTP/2] [1] OPENED stream for https://<fqdn>/</div></blockquote></div><div><br></div><div>So it tries with http/3, gets a wrong certificate (the server default one), then it switches to http/2 and goes on. </div><div>The first attempt with http/3 probably gives problems with some browsers?</div><div>If this is the case, is there a way to avoid this or should I simply configure http/3 on all domains?</div></div></div></blockquote><div><br></div><div>Why would you (or client) connect to an http/3 port for a server which does not support http/3?</div><div>What would be your expectation in this case? The same will happen for http/1 and http/2 as well.</div><div>You can connect to an http/1 ssl port, request a missing server and receive a default server certificate.</div><div>It's just there is no fallback for http/1 and client will just give up.</div><div><br></div><div>The add_header suggests that http/3 is supported for a certain server.</div><div>It should not be sent for servers which do not support http/3, and clients should not use http/3 for them.</div><br><blockquote type="cite"><div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><div>If it does, this will mislead clients by offering them to switch to unsupported http/3.</div><br><blockquote type="cite"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Nginx version: nginx/1.26.1 on ubuntu 22.04</div><div><br></div><div>Thanks.</div><div>Riccardo</div></div>_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>https://mailman.nginx.org/mailman/listinfo/nginx<br></div></blockquote></div><br><div><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>----</div><div>Roman Arutyunyan</div><div><a href="mailto:arut@nginx.com">arut@nginx.com</a></div><div><br></div></div></div></div></div></blockquote><div><br></div><div>Riccardo</div><br><blockquote type="cite"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"></div><br></div>_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br><a href="https://mailman.nginx.org/mailman/listinfo/nginx">https://mailman.nginx.org/mailman/listinfo/nginx</a><br></div></blockquote></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">nginx mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="mailto:nginx@nginx.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">nginx@nginx.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="https://mailman.nginx.org/mailman/listinfo/nginx" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://mailman.nginx.org/mailman/listinfo/nginx</a></div></blockquote></div><br><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>----</div><div>Roman Arutyunyan</div><div>arut@nginx.com</div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">

</div>
<br></body></html>