Skip to content

nginx: fix HTTP/3 reuseport duplicates#5184

Open
Boubik wants to merge 1 commit intoopnsense:masterfrom
Boubik:fix/nginx-http3
Open

nginx: fix HTTP/3 reuseport duplicates#5184
Boubik wants to merge 1 commit intoopnsense:masterfrom
Boubik:fix/nginx-http3

Conversation

@Boubik
Copy link
Contributor

@Boubik Boubik commented Feb 3, 2026

Fix HTTP/3 reuseport duplicates

This PR fixes an Nginx config-generation issue introduced while adding optional HTTP/3 (QUIC) support in nginx: add optional HTTP/3 #5071.
When multiple server blocks ended up emitting reuseport for the same listen (same address:port), Nginx failed to start.

Reference PR: nginx: add optional HTTP/3 #5071 (#5071)


Problem

With HTTP/3 enabled on more than one server for the same address:port, the generated configuration could contain reuseport multiple times for the same socket.
reuseport is a socket option and must be applied consistently for a given address:port. When duplicated across multiple server blocks for the same listener, Nginx reports an error and refuses to start.


Fix

We now emit reuseport exactly once per address:port for HTTP/3:

  • The first generated HTTP/3 listen for a given address:port gets: quic reuseport
  • Any additional HTTP/3 listen directives for the same address:port get: quic (without reuseport)

This guarantees that the socket option is not duplicated and prevents Nginx from failing due to conflicting listen parameters.


Testing

Tested on a local OPNsense instance with multiple server blocks sharing the same address:port and HTTP/3 enabled on more than one of them.
If you have a different setup (especially more complex listener/server combinations), please give it a quick try — there may still be edge cases I did not cover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant