--proxy snippets: nginx answers 421 for any other name on its TLS port #51

Merged
jcoffey-dev merged 1 commits from fix/48-421-fallback into main 2026-11-08 23:13:03 +00:00
Owner

A follow-up to #49. With HTTP/2 a browser reuses the webmail's connection for any name its certificate covers, so with one certificate for all three names a request for the mail server could reach nginx's console or webmail block. A default server on 127.0.0.1:8444 now answers any other name with 421, so the browser reconnects and the router passes it through. The reporter of #48 pointed this out in the forum.

Checked against nginx 1.26 in a container; the proxy-snippets e2e case checks it too.

A follow-up to #49. With HTTP/2 a browser reuses the webmail's connection for any name its certificate covers, so with one certificate for all three names a request for the mail server could reach nginx's console or webmail block. A default server on 127.0.0.1:8444 now answers any other name with 421, so the browser reconnects and the router passes it through. The reporter of #48 pointed this out in the forum. Checked against nginx 1.26 in a container; the proxy-snippets e2e case checks it too.
jcoffey-dev added 1 commit 2026-11-08 22:53:08 +00:00
A browser reuses an HTTP/2 connection for every name its certificate
covers. With one certificate for the console's, the webmail's and the
mail server's names, a request for the mail server can arrive over the
webmail's connection, past the router, and nginx answered it as the
webmail or the console. A default server on 127.0.0.1:8444 now answers
any name but those two with 421 Misdirected Request, so the browser
opens a connection of its own for it, and the router passes that one
through. It needs no certificate: ssl_reject_handshake refuses a
handshake for any other name, and the router sends none.

The reporter of #48 pointed this out. Checked against nginx 1.26 with
one certificate for all three names: their own names reach the console
and the webmail, anything else gets 421; the e2e case checks it too.
jcoffey-dev merged commit 596e5370cb into main 2026-11-08 23:13:03 +00:00
jcoffey-dev deleted branch fix/48-421-fallback 2026-11-08 23:13:03 +00:00
Sign in to join this conversation.