You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If setting management.endpoint.health.cache.time-to-live to any value (e.g. 60s) if hitting the health-endpoint with a trailing slash (e.g. localhost:8080/actuator/health/ the cache is ignored and all health indicators are executed every time. To show that the reproducer contains a custom HealthIndicator that prints out a line every time it's invoked.
Endpoints automatically cache responses to read operations that do not take any parameters.
I know that you could argue that calling /actuator/health/ is resulting in a call to a read operation with an empty parameter, but I was confused by this behaviour, and it did me take some time to figure out what's happening here and why my time to live was “ignored”. In most cases, I, and I suspect others do too, expect that a URL that works with and without a trailing slash behaves the same.
The text was updated successfully, but these errors were encountered:
philwebb
changed the title
Calling /actuator/health with a trailing slash ignores the set cache time to live
Calling '/actuator/health' with a trailing slash ignores the set cache time to live
May 23, 2025
Reproducer can be found at mvitz/actuator-time-to-live.
If setting
management.endpoint.health.cache.time-to-live
to any value (e.g.60s
) if hitting the health-endpoint with a trailing slash (e.g.localhost:8080/actuator/health/
the cache is ignored and all health indicators are executed every time. To show that the reproducer contains a customHealthIndicator
that prints out a line every time it's invoked.The Actuator documentation states within Configuring Endpoints:
I know that you could argue that calling
/actuator/health/
is resulting in a call to a read operation with an empty parameter, but I was confused by this behaviour, and it did me take some time to figure out what's happening here and why my time to live was “ignored”. In most cases, I, and I suspect others do too, expect that a URL that works with and without a trailing slash behaves the same.The text was updated successfully, but these errors were encountered: