Skip to content

Matrix parameters distort the values passed to a match all remaining selector when using WebFlux #52300

Closed

Description

@manuel-umu

Spring Boot: 4.2.0-M2 (works in 4.1.1)

With Spring MVC, path parameters (for example a ;jsessionid=... added by URL rewriting) are no longer removed from the path segments passed to endpoint operations that use @Selector(match = Match.ALL_REMAINING). This breaks health group and component paths, and changes the values that custom endpoints receive.

With management.endpoint.health.probes.enabled=true, management.endpoint.health.show-components=always and management.endpoint.health.group.custom.include=ping,diskSpace:

Request 4.1.1 4.2.0-M2
/actuator/health/liveness;jsessionid=abc 200 404
/actuator/health/diskSpace;jsessionid=abc 200 404
/actuator/health/custom/ping;x=1 200 404
/actuator/health/custom;x=1/ping 200 500

For a custom endpoint:

@Endpoint(id = "echo")
class EchoEndpoint {

	@ReadOperation
	String echo(@Selector(match = Match.ALL_REMAINING) String... path) {
		return String.join("|", path);
	}

}

GET /actuator/echo/a/b;jsessionid=abc returns a|b in 4.1.1 and a|b;jsessionid=abc in 4.2.0-M2.

This seems to come from #51470. getRemainingPathSegments in AbstractWebMvcEndpointHandlerMapping now tokenizes pathPattern.extractPathWithinPattern(...).value(), which keeps path parameters, whereas the previous code used PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE.

Using the decoded value of each segment without its parameters restores the 4.1.1 behavior. I verified this locally against all the cases above, and the multi-segment additional paths from #51470 keep working:

PathContainer remainingPath = pathPattern
	.extractPathWithinPattern(ServletRequestPathUtils.getParsedRequestPath(request).pathWithinApplication());
return remainingPath.elements()
	.stream()
	.filter(PathContainer.PathSegment.class::isInstance)
	.map((element) -> ((PathContainer.PathSegment) element).valueToMatch())
	.filter(StringUtils::hasLength)
	.toArray(String[]::new);

I'd be happy to submit a PR with this change and a test.

Activity

  1. changed the title [-]Matrix parameters break actuator health paths and ALL_REMAINING selectors with Spring MVC in 4.2.0-M2[/-] [+]Matrix parameters distort the values passed to a match all remaining selector when using WebFlux[/+] on Oct 23, 2026
  2. added and removed
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    on Oct 23, 2026
  3. added this to the 4.0.x milestone on Oct 23, 2026
  4. self-assigned this
    on Oct 23, 2026
  5. modified the milestones: 4.0.x, 4.0.10 on Oct 23, 2026
  6. added a commit that references this issue on Oct 23, 2026
    626eba6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions