SpringBoot disable Actuator root
up vote
1
down vote
favorite
i'm using springboot and i'm exposing metrics with actuator and prometheus. I want to expose "info", "health", "metrics", "prometheus", "shutdown" and nothing more. But even if i specify into the application properties, what i see is that even the root "/actuator" is exposed.
I would like to disable the root actuator and have only the 5 member that I said previously.
Is there a way to don't expose only the /actuator endpoint? I've also tried in application properties doing like this:
management.endpoints.web.exposure.exclude=actuator
That is the list of the exposed actuator:
{
"_links": {
"self": {
"href": "http://localhost:9002/actuator",
"templated": false
},
"health-component-instance": {
"href": "http://localhost:9002/actuator/health/{component}/{instance}",
"templated": true
},
"health-component": {
"href": "http://localhost:9002/actuator/health/{component}",
"templated": true
},
"health": {
"href": "http://localhost:9002/actuator/health",
"templated": false
},
"shutdown": {
"href": "http://localhost:9002/actuator/shutdown",
"templated": false
},
"info": {
"href": "http://localhost:9002/actuator/info",
"templated": false
},
"prometheus": {
"href": "http://localhost:9002/actuator/prometheus",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:9002/actuator/metrics/{requiredMetricName}",
"templated": true
},
"metrics": {
"href": "http://localhost:9002/actuator/metrics",
"templated": false
}
}
}
java spring spring-boot openshift prometheus
add a comment |
up vote
1
down vote
favorite
i'm using springboot and i'm exposing metrics with actuator and prometheus. I want to expose "info", "health", "metrics", "prometheus", "shutdown" and nothing more. But even if i specify into the application properties, what i see is that even the root "/actuator" is exposed.
I would like to disable the root actuator and have only the 5 member that I said previously.
Is there a way to don't expose only the /actuator endpoint? I've also tried in application properties doing like this:
management.endpoints.web.exposure.exclude=actuator
That is the list of the exposed actuator:
{
"_links": {
"self": {
"href": "http://localhost:9002/actuator",
"templated": false
},
"health-component-instance": {
"href": "http://localhost:9002/actuator/health/{component}/{instance}",
"templated": true
},
"health-component": {
"href": "http://localhost:9002/actuator/health/{component}",
"templated": true
},
"health": {
"href": "http://localhost:9002/actuator/health",
"templated": false
},
"shutdown": {
"href": "http://localhost:9002/actuator/shutdown",
"templated": false
},
"info": {
"href": "http://localhost:9002/actuator/info",
"templated": false
},
"prometheus": {
"href": "http://localhost:9002/actuator/prometheus",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:9002/actuator/metrics/{requiredMetricName}",
"templated": true
},
"metrics": {
"href": "http://localhost:9002/actuator/metrics",
"templated": false
}
}
}
java spring spring-boot openshift prometheus
1
No there isn't as/actuator
is the main entry point for all other actuators.
– M. Deinum
Nov 7 at 14:02
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
i'm using springboot and i'm exposing metrics with actuator and prometheus. I want to expose "info", "health", "metrics", "prometheus", "shutdown" and nothing more. But even if i specify into the application properties, what i see is that even the root "/actuator" is exposed.
I would like to disable the root actuator and have only the 5 member that I said previously.
Is there a way to don't expose only the /actuator endpoint? I've also tried in application properties doing like this:
management.endpoints.web.exposure.exclude=actuator
That is the list of the exposed actuator:
{
"_links": {
"self": {
"href": "http://localhost:9002/actuator",
"templated": false
},
"health-component-instance": {
"href": "http://localhost:9002/actuator/health/{component}/{instance}",
"templated": true
},
"health-component": {
"href": "http://localhost:9002/actuator/health/{component}",
"templated": true
},
"health": {
"href": "http://localhost:9002/actuator/health",
"templated": false
},
"shutdown": {
"href": "http://localhost:9002/actuator/shutdown",
"templated": false
},
"info": {
"href": "http://localhost:9002/actuator/info",
"templated": false
},
"prometheus": {
"href": "http://localhost:9002/actuator/prometheus",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:9002/actuator/metrics/{requiredMetricName}",
"templated": true
},
"metrics": {
"href": "http://localhost:9002/actuator/metrics",
"templated": false
}
}
}
java spring spring-boot openshift prometheus
i'm using springboot and i'm exposing metrics with actuator and prometheus. I want to expose "info", "health", "metrics", "prometheus", "shutdown" and nothing more. But even if i specify into the application properties, what i see is that even the root "/actuator" is exposed.
I would like to disable the root actuator and have only the 5 member that I said previously.
Is there a way to don't expose only the /actuator endpoint? I've also tried in application properties doing like this:
management.endpoints.web.exposure.exclude=actuator
That is the list of the exposed actuator:
{
"_links": {
"self": {
"href": "http://localhost:9002/actuator",
"templated": false
},
"health-component-instance": {
"href": "http://localhost:9002/actuator/health/{component}/{instance}",
"templated": true
},
"health-component": {
"href": "http://localhost:9002/actuator/health/{component}",
"templated": true
},
"health": {
"href": "http://localhost:9002/actuator/health",
"templated": false
},
"shutdown": {
"href": "http://localhost:9002/actuator/shutdown",
"templated": false
},
"info": {
"href": "http://localhost:9002/actuator/info",
"templated": false
},
"prometheus": {
"href": "http://localhost:9002/actuator/prometheus",
"templated": false
},
"metrics-requiredMetricName": {
"href": "http://localhost:9002/actuator/metrics/{requiredMetricName}",
"templated": true
},
"metrics": {
"href": "http://localhost:9002/actuator/metrics",
"templated": false
}
}
}
java spring spring-boot openshift prometheus
java spring spring-boot openshift prometheus
edited Nov 7 at 17:00
Sofo Gial
13012
13012
asked Nov 7 at 13:46
osh arko
315
315
1
No there isn't as/actuator
is the main entry point for all other actuators.
– M. Deinum
Nov 7 at 14:02
add a comment |
1
No there isn't as/actuator
is the main entry point for all other actuators.
– M. Deinum
Nov 7 at 14:02
1
1
No there isn't as
/actuator
is the main entry point for all other actuators.– M. Deinum
Nov 7 at 14:02
No there isn't as
/actuator
is the main entry point for all other actuators.– M. Deinum
Nov 7 at 14:02
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
There is no configuration value for this. The best you can do right now is move the management base endpoint to /
, in which case the discovery page is disabled to prevent clashing with other endpoints in your app:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-endpoints-hypermedia
When the management context path is set to /, the discovery page is disabled to prevent the possibility of a clash with other mappings.
If you're using Spring Security you can effectively hide the discovery page using something like this inside your own WebSecurityConfigurerAdapter
:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.mvcMatchers("/actuator").denyAll()
.mvcMatchers("/actuator/").denyAll()
}
This would deny all requests to the discovery page, but allow requests through to the individual exposed endpoints.
There is some discussion of the discovery page in this GitHub issue as well:
https://github.com/spring-projects/spring-boot/issues/10331
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try settingmanagement.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under/
instead of/actuator
.
– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
There is no configuration value for this. The best you can do right now is move the management base endpoint to /
, in which case the discovery page is disabled to prevent clashing with other endpoints in your app:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-endpoints-hypermedia
When the management context path is set to /, the discovery page is disabled to prevent the possibility of a clash with other mappings.
If you're using Spring Security you can effectively hide the discovery page using something like this inside your own WebSecurityConfigurerAdapter
:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.mvcMatchers("/actuator").denyAll()
.mvcMatchers("/actuator/").denyAll()
}
This would deny all requests to the discovery page, but allow requests through to the individual exposed endpoints.
There is some discussion of the discovery page in this GitHub issue as well:
https://github.com/spring-projects/spring-boot/issues/10331
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try settingmanagement.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under/
instead of/actuator
.
– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
add a comment |
up vote
1
down vote
There is no configuration value for this. The best you can do right now is move the management base endpoint to /
, in which case the discovery page is disabled to prevent clashing with other endpoints in your app:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-endpoints-hypermedia
When the management context path is set to /, the discovery page is disabled to prevent the possibility of a clash with other mappings.
If you're using Spring Security you can effectively hide the discovery page using something like this inside your own WebSecurityConfigurerAdapter
:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.mvcMatchers("/actuator").denyAll()
.mvcMatchers("/actuator/").denyAll()
}
This would deny all requests to the discovery page, but allow requests through to the individual exposed endpoints.
There is some discussion of the discovery page in this GitHub issue as well:
https://github.com/spring-projects/spring-boot/issues/10331
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try settingmanagement.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under/
instead of/actuator
.
– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
add a comment |
up vote
1
down vote
up vote
1
down vote
There is no configuration value for this. The best you can do right now is move the management base endpoint to /
, in which case the discovery page is disabled to prevent clashing with other endpoints in your app:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-endpoints-hypermedia
When the management context path is set to /, the discovery page is disabled to prevent the possibility of a clash with other mappings.
If you're using Spring Security you can effectively hide the discovery page using something like this inside your own WebSecurityConfigurerAdapter
:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.mvcMatchers("/actuator").denyAll()
.mvcMatchers("/actuator/").denyAll()
}
This would deny all requests to the discovery page, but allow requests through to the individual exposed endpoints.
There is some discussion of the discovery page in this GitHub issue as well:
https://github.com/spring-projects/spring-boot/issues/10331
There is no configuration value for this. The best you can do right now is move the management base endpoint to /
, in which case the discovery page is disabled to prevent clashing with other endpoints in your app:
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-endpoints-hypermedia
When the management context path is set to /, the discovery page is disabled to prevent the possibility of a clash with other mappings.
If you're using Spring Security you can effectively hide the discovery page using something like this inside your own WebSecurityConfigurerAdapter
:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.mvcMatchers("/actuator").denyAll()
.mvcMatchers("/actuator/").denyAll()
}
This would deny all requests to the discovery page, but allow requests through to the individual exposed endpoints.
There is some discussion of the discovery page in this GitHub issue as well:
https://github.com/spring-projects/spring-boot/issues/10331
edited Nov 7 at 14:48
answered Nov 7 at 14:05
Mike
1,174716
1,174716
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try settingmanagement.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under/
instead of/actuator
.
– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
add a comment |
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try settingmanagement.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under/
instead of/actuator
.
– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Hi mike, thanks for replying. i didn't understand how to override the actuator path. i tried exposing an api rest at the same path, but mine is not considered
– osh arko
Nov 7 at 14:27
Try setting
management.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Try setting
management.endpoints.web.base-path=/
– Mike
Nov 7 at 14:32
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
Good, like this actuator is not expose. but now isn't there a way to expose the actuator under /actuator instead of the main root?
– osh arko
Nov 7 at 14:36
1
1
Correct, that's the downside I was pointing out: all the exposed endpoints are now under
/
instead of /actuator
.– Mike
Nov 7 at 14:38
Correct, that's the downside I was pointing out: all the exposed endpoints are now under
/
instead of /actuator
.– Mike
Nov 7 at 14:38
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
I have added a spring security code sample for how to hide the discovery page while leaving the exposed endpoints working.
– Mike
Nov 7 at 14:48
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190729%2fspringboot-disable-actuator-root%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
No there isn't as
/actuator
is the main entry point for all other actuators.– M. Deinum
Nov 7 at 14:02