Skip to content

Support multi-segment paths when mapping a health group to an additional path #48374

Closed as duplicate

Description

@MelleD

Context:
I have all actuator endpoints on a protected server port. In addition to health, I would also like to share them on the main server.
However, health is then always directly on the root path, e.g. http://localhost:8080/health.

I have tested various options for inserting a base path.

None of them work.

Case 1:

management.endpoint.health.group.public.additional-path=server:/myBasePath/health

Error:
Caused by: java.lang.IllegalArgumentException: 'value' must contain only one segment.
	at org.springframework.util.Assert.isTrue(Assert.java:116) ~[spring-core-6.2.12.jar:6.2.12]

Case 2:

management.endpoint.health.group.public.additional-path=server:/health
management.server.base-path=/myBasePath
#management.endpoints.web.base-path=/myBasePath
#management.endpoints.web.path-mapping.health=myBasePath/health

http://localhost:8080/myBasePath/health --> not found

Is this a bug or what is the reason that there is no base path on the main port?

Activity

  1. wilkinsona commented on Dec 2, 2025

    @wilkinsona
    Member

    This isn't supported at the moment.

    Case 1 is working as documented:

    This would make the live health group available on the main server port at /healthz. The prefix is mandatory and must be either server: (represents the main server port) or management: (represents the management port, if configured.) The path must be a single path segment.

    Case 2 is also working as I would expect. The management server's base path has no effect as you're exposing the endpoint on the main (not management) server.

    We might be able to relax the restriction in case 1, but I don't recall the reasons for it so it may not be possible. I'll discuss it with the rest of the team.

  2. changed the title [-]Web base-path is not working on main port when management port is active[/-] [+]Support multi-segment paths when mapping a health group to an additional path[/+] on Dec 2, 2025
  3. MelleD commented on Dec 2, 2025

    @MelleD
    ContributorAuthor

    That would be great, because if you are behind a Spring Cloud gateway with the same domain, for example, you have no chance (except with a lot of configuration and stripping) of forwarding the health check to the service if you have more than 1 service

  4. philwebb commented on Dec 2, 2025

    @philwebb
    Member

    I have a feeling we used a single path to align with standard actuator mappings where the endpoint ID is used as the path and cannot contains /. Looking at AdditionalHealthEndpointPathsWebMvcHandlerMapping, I think it should be possible to support more segments (at least for Spring MVC). The org.springframework.boot.webmvc.actuate.endpoint.web.AbstractWebMvcEndpointHandlerMapping.createRequestMappingInfo(WebOperationRequestPredicate, String) method already has subPath support.

  5. MelleD commented on Dec 2, 2025

    @MelleD
    ContributorAuthor

    I have a feeling we used a single path to align with standard actuator mappings where the endpoint ID is used as the path and cannot contains /. Looking at AdditionalHealthEndpointPathsWebMvcHandlerMapping, I think it should be possible to support more segments (at least for Spring MVC). The org.springframework.boot.webmvc.actuate.endpoint.web.AbstractWebMvcEndpointHandlerMapping.createRequestMappingInfo(WebOperationRequestPredicate, String) method already has subPath support.

    Yes could be: then maybe an additional-base-path is missing, but looks then maybe confusing with the server: and management: prefix

  6. added and removed
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    for: team-meetingAn issue we'd like to discuss as a team to make progress
    on Aug 26, 2026
  7. added this to the 4.x milestone on Aug 26, 2026
  8. wilkinsona commented on Sep 15, 2026

    @wilkinsona
    Member

    Closing in favour of #51470.

  9. removed this from the 4.x milestone on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions