nginx: fix HTTP/3 reuseport duplicates#5184
Open
Boubik wants to merge 1 commit intoopnsense:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
reuseportfor the samelisten(sameaddress: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 containreuseportmultiple times for the same socket.reuseportis a socket option and must be applied consistently for a givenaddress:port. When duplicated across multiple server blocks for the same listener, Nginx reports an error and refuses to start.Fix
We now emit
reuseportexactly once peraddress:portfor HTTP/3:listenfor a givenaddress:portgets:quic reuseportlistendirectives for the sameaddress:portget:quic(withoutreuseport)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:portand 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.