Repository navigation
Treat a blank hostValue as unset in RewriteLocationResponseHeader - #4317
Open
sharanggupta wants to merge 1 commit into
Open
sharanggupta wants to merge 1 commit into
sharanggupta wants to merge 1 commit into
Conversation
The server-webflux RewriteLocationResponseHeaderGatewayFilterFactory only checked config.getHostValue() for null, so a blank value, such as an empty `hostValue:` named argument in application.yml, replaced the host:port portion of the Location header with an empty string and produced URLs like `https:///some/object/id`. Fall back to the request Host header whenever hostValue has no text, matching the server-webmvc filter (see spring-cloudgh-4315), and document the blank case on the webflux filter page. Fixes spring-cloudgh-4316 Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
This branch has not been deployed
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.
Fixes gh-4316
The server-webflux
RewriteLocationResponseHeaderGatewayFilterFactoryonly checkedhostValuefornull, so a blank value (e.g. an emptyhostValue:named argument) replaced thehost:portportion of theLocationheader with an empty string, producinghttps:///some/object/id.This change falls back to the request
Hostheader wheneverhostValuehas no text (StringUtils.hasText), matching the server-webmvc filter (#4315), adds a unit test for the blank case, and documents the blank fallback on the webflux filter page.Verified with
./mvnw -pl spring-cloud-gateway-server-webflux test -Dtest='RewriteLocation*'(16 tests, 0 failures) and./mvnw -pl spring-cloud-gateway-server-webflux validate(javaformat + checkstyle).