Skip to content

ServletEndpoints do not consider server.servlet.path #13124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

ServletEndpoints do not consider server.servlet.path #13124

wants to merge 5 commits into from

Conversation

gmcouto
Copy link

@gmcouto gmcouto commented May 9, 2018

Summary

I have changed ServletEndpointManagementContextConfiguration and documentation to support ServletEndpoints to have same path than web management endpoints.

The problem

If your server has no management port set and there is a "server.servlet.path" set, the ServletEndpoint registration path would not consider "server.servlet.path" as all other web management endpoints. So the resulting path for servlet endpoints will look different from other web management paths.

In this case, for example, with jolokia:
How the jolokia endpoint is currently:
http://host:port/context-path/actuator/jolokia

Examples of other endpoints that I am trying to mimic:
http://host:port/context-path/servlet-path/actuator/health
http://host:port/context-path/servlet-path/actuator/auditevents
http://host:port/context-path/servlet-path/actuator/beans

How the jolokia endpoint should be:
http://host:port/context-path/servlet-path/actuator/jolokia

The fix

This pull requests ensures the desired behaviour, and add to the documentation the information that it does consider "server.servlet.path" whenever management port is not set.

The way it was implemented is that ServletEndpointManagementContextConfiguration will have two configurations, one for different context (different management port), and another for same context.

The configuration for different context will be the same as before.
The configuration for same context will pull "server.servlet.path" from environment and add it to the servlet registration base path.

@gmcouto gmcouto changed the title Fixes gh-13106 ServletEndpoints do not consider server.servlet.path May 9, 2018
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 9, 2018
@mbhave
Copy link
Contributor

mbhave commented May 10, 2018

Thanks for the PR @gmcouto but I have a slightly different fix for it.

@mbhave mbhave closed this May 10, 2018
@mbhave mbhave added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants