Repository navigation
fix: return 421 for SNI and Host mismatches on mTLS requests - #14013
Open
ruanweihong-aaa wants to merge 2 commits into
Open
ruanweihong-aaa wants to merge 2 commits into
ruanweihong-aaa wants to merge 2 commits into
Conversation
ruanweihong-aaa
marked this pull request as ready for review
October 8, 2026 07:08
nic-6443
approved these changes
Oct 8, 2026
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.
Description
HTTP/2 clients can reuse a TLS connection established for origin A to send requests to origin B when both origins share an endpoint and the server certificate covers both.
When B requires mTLS and the request Host differs from the connection's SNI, APISIX currently returns 400. On vanilla OpenResty, a missing client certificate can cause this rejection before the SNI mismatch check.
Return 421 Misdirected Request for the existing SNI/Host mismatch restriction, so clients can retry using a new connection with the target origin's SNI and provide its required client certificate.
Changes
false, 421for this mismatch.core.response.exit(status or 400)at the call site, preserving 400 for other verification failures.The existing restriction remains: mismatched SNI and Host are rejected even if both origins share the same mTLS configuration. No new SSL configuration is required.
Which issue(s) this PR fixes:
Fixes #14008
Verification
git diff --checkpassed.The full repository Test::Nginx suite has not been run. The browser test used
no-corsand did not verify JavaScript access to a business API response. This draft is for initial review.Checklist
Compatibility note: requests rejected for this mismatch now receive 421 instead of 400. Other verification failures retain their existing behavior.