fix(http2): avoid including default port in authority string#7256
Merged
DigitalBrainJS merged 2 commits intoaxios:v1.xfrom Dec 19, 2025
Merged
fix(http2): avoid including default port in authority string#7256DigitalBrainJS merged 2 commits intoaxios:v1.xfrom
DigitalBrainJS merged 2 commits intoaxios:v1.xfrom
Conversation
DigitalBrainJS
approved these changes
Dec 18, 2025
This was referenced Jan 25, 2026
This was referenced Feb 9, 2026
|
رقم 7256 |
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: Remove Default Port From HTTP/2
:authorityHeader (#7249)Problem
Certain HTTP/2 servers reject requests when the
:authorityheader includes a default port value that is already implied by the protocol. Axios previously generated an authority string like:Even when the URL did not explicitly specify a port. Some HTTP/2 implementations expect the header to omit default ports and therefore responded with connection errors or rejected the request because the authority value was considered invalid.
Solution
The logic in
lib/adapters/http.jshas been updated to::authoritywhen it is the protocol default8080,8443)After this change, Axios now generates:
unless a custom port was intentionally provided.
Testing
A regression test has been added to confirm this behavior and ensure long-term consistency.
Impact
This change improves Axios compatibility with strict HTTP/2 servers by aligning the authority header formatting with expected protocol behavior. The update is non-breaking, does not alter API usage, and includes test coverage to prevent future regressions.