Refactor HTTP header configuration to use server.http.max structure and remove middleware-level limits #8286
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.
This PR refactors the HTTP header configuration implementation from PR #8269 to address performance and architectural concerns while improving the configuration structure.
Key Changes
Removed Middleware-Level Header Limits
Eliminated the middleware-tier header limit enforcement that was added to the
limits
plugin:http_max_request_headers
andhttp_max_header_list_items
configuration optionsRequestHeaderCountLimitLayer
,RequestHeaderListItemsLimitLayer
)This ensures all header limits are enforced at the HTTP server level for optimal performance, avoiding any potential middleware overhead.
Restructured Configuration to Use
server.http.max
Reorganized the server HTTP configuration to use a cleaner nested structure:
Before:
After:
Maintained Full Backward Compatibility
max_header_size
,max_headers
,max_header_list_size
) continue to workeffective_max()
method that merges new and legacy configurationsUpdated Documentation
server.http.max
structureBenefits
server.http.max
structureThe refactoring maintains all existing functionality while providing a cleaner, more performant implementation that aligns with the router's architectural goals.
Fixes the architectural and performance concerns from the original PR #8269 implementation.
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.