spring-boot-admin icon indicating copy to clipboard operation
spring-boot-admin copied to clipboard

org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'HEAD' not supported

Open hsoftxl opened this issue 9 years ago • 4 comments

when click Environment Tab , print error log org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'HEAD' not supported the request is 2017-02-06 14:40:31.372 DEBUG 1288 --- [nio-8011-exec-5] o.a.c.authenticator.AuthenticatorBase : Security checking request HEAD /refresh

why is a HEAD request?

hsoftxl avatar Feb 06 '17 06:02 hsoftxl

The error is ok. The HEAD request is done to detect the spring cloud /refresh endpoint. The error occurs if it is not present.

joshiste avatar Feb 06 '17 07:02 joshiste

I have inconsistency with some applications the call to HEAD (/refresh ) works for some of them and the other applications are retuning 500. although all of them the call to POST (/refresh) works. this is resulting in not being able to update configurations from spring boot admin. what can be the cause of the issue? i checked all dependencies they seem all to have the same. and i can see in the logs that /refresh is exposed on method post

2017-02-21 15:00:08.913  INFO [stc_sa-subscribe,,,] 4597 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/refresh || /refresh.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()

hodeh avatar Feb 21 '17 17:02 hodeh

Is there some error logged either from the zuul proxy inside the admin server or the application itself ?

joshiste avatar Feb 22 '17 07:02 joshiste

@joshiste thanks i found the problem so its because the @RestControllerAdvice class has a @ ExceptionHandler(Exception.class) , which handles the unspecified exceptions by returning 500 and considers it as internal server error. now I am explicitly defining the HttpRequestMethodNotSupportedException to be handled with the default actuator JSON response (405) which the spring boot admin expects everything is normal.

hodeh avatar Feb 23 '17 07:02 hodeh