Fix EndpointRequest.toLinks() when base-path is '/'#49191
Open
bbbbooo wants to merge 1 commit intospring-projects:mainfrom
Open
Fix EndpointRequest.toLinks() when base-path is '/'#49191bbbbooo wants to merge 1 commit intospring-projects:mainfrom
bbbbooo wants to merge 1 commit intospring-projects:mainfrom
Conversation
When management.endpoints.web.base-path is empty and management runs on a different port, EndpointRequest.toLinks() and toAnyEndpoint() do not match the links endpoint consistently. Derive the links path based on the management port type on both servlet and reactive sides, and add regression tests for each implementation. Fixes spring-projects#34834 Signed-off-by: bbbbooo <hyeons1213@gmail.com>
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.
Problem
When
management.endpoints.web.base-pathis set to/, it is normalizedto an empty path internally. In this setup, when management runs on a
different port,
EndpointRequest.toLinks()never matches.As a result, security configurations such as
EndpointRequest.toLinks().permitAll()do not work as expected.This behavior is inconsistent with the actual links endpoint mapping.
Changes
WebApplicationContextto determine the effective links path./when the management port is differentand the base path is empty.
EndpointRequest.toLinks()EndpointRequest.toAnyEndpoint()(links inclusion path)Tests
Added/updated tests for both servlet and reactive variants to cover:
toAnyEndpointwith an empty base path and a different management port(links should match)
toLinkswith an empty base path and a different management port(root links matching)
Fixes #34834