Fix #3729: Support optional parameters in RewriteLocationResponseHeader filter #3886
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 #3729: Support optional parameters in RewriteLocationResponseHeader filter
Summary
This PR resolves issue #3729 by adding overloaded methods for the
RewriteLocationResponseHeader
filter, enabling flexible YAML configuration with optional parameters.Problem
Users were unable to use the
RewriteLocationResponseHeader
filter in YAML configuration with optional parameters. The filter only supported the full 4-parameter signature, causing failures when users tried to use shorter forms:Error:
Solution
Added method overloads to support 1, 2, 3, and 4 parameters in both
FilterFunctions
andAfterFilterFunctions
:Changes Made
Code Changes
@Shortcut
annotationYAML Configuration Support
Now supports all these configurations:
Testing
New Tests Added
rewriteLocationResponseHeaderWithMinimalArgsWorks()
- Tests 1 parameterrewriteLocationResponseHeaderWithTwoArgsWorks()
- Tests 2 parametersrewriteLocationResponseHeaderWithThreeArgsWorks()
- Tests 3 parametersTest Results
Verification
All tests verify the
Location
header is correctly rewritten:Location
header and request HostBackward Compatibility
✅ 100% backward compatible
Documentation Updates
Updated the AsciiDoc documentation to include:
Code Quality
Related Issue
Resolves #3729
Checklist