-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Actuator health endpoint could accept any media type #20880
Comments
Thanks for the report, @AlexFalappa, but I don't think I understand the problem. A request sent to
What version of Spring Boot do I need to use and what steps do I need to follow to reproduce the 406 response? |
@wilkinsona I am using 2.2.6.RELEASE on Linux, the application has |
A freshly generated project on start.spring.io does not exhibit the wrong behaviour. Investigating... |
Found the reason. This is the main class: @SpringBootApplication
public class EchoApplication implements WebMvcConfigurer {
public static void main(String[] args) {
SpringApplication.run(EchoApplication.class, args);
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.TEXT_PLAIN);
}
} Setting the default content type to Can the actuator endpoints be shielded from such configurations by default? Can I have the default media type specified for application Given that my request is a bit borderline I think you can close the issue as not designed/supported. |
This would be covered with #20290, which we're currently investigating right now. Thanks! |
Faced this need while deploying a simple Spring Boot application with actuator on a container AWS Elastic Container Service and exposing it through an Elastic Load Balancer: the container was failing the load balancer health checks and was continuously restarted.
I had configurred the health check as HTTP GET on
/actuator/health
giving 200 OK. A look at the log revealed the health check getting instead HTTP 406.I replicated this behaviour locally with Postman (which sends
Accept:*/*
by default) and looked at the Actuator code where I found thatapplication/json
is the only accepted media type.Relaxing the media type requirement (but I don't know if this was a design choice), possibly only on the health check, could make the actuator health endpoint usable even in this scenario.
Of course defining a custom SpringMVC endpoint would be another solution for my use case.
The text was updated successfully, but these errors were encountered: