1

I experience a strange behavior of actuators.

I have set up a spring boot 2.1 application with Jersey. I extended the application, so that actuators like health are working. Within the JerseyConfig i added property(FILTER_FORWARD_ON_404, true); The jersey filtering is configured as follows spring.jersey.type=filter

The actuator endpoint works as expected so actuator/health returns a 200 and the expected response, but in fact jersey throws an NotFoundexception internally, which can seen in logs and be catched with javax.ws.rs.ext.ExceptionMapper<Throwable> but the exception seems to be ignored (which is achieved by FILTER_FORWARD_ON_404, i believe). Is there a way to avoid, that the exception is thrown?

I expected 404 logs in case of actuator call, but actually they are logged

Neophyn33
  • 21
  • 3
  • Instead of `FILTER_FORWARD_ON_404`, try to use [`FILTER_STATIC_CONTENT_REGEX`](https://jersey.github.io/apidocs/2.26/jersey/org/glassfish/jersey/servlet/ServletProperties.html#FILTER_STATIC_CONTENT_REGEX). With he former, you're allowing the application to look for the resource, and when it's not found (a 404), then it will forward the request. With the latter property, I believe Jersey will first look for those regex matches before looking for the resource. If there is a match, then the request will get forwarded. So no 404 and no exception. But you have to build that nasty regex :-( – Paul Samsotha Sep 06 '19 at 07:12
  • Take a look at https://stackoverflow.com/questions/23946308/jax-rs-2-using-jersey-client-getting-http-404-not-found-but-same-url-is-work. Hope it will be helpfull – prosstokvawa Aug 11 '20 at 13:09

0 Answers0