Skip to content

Calling '/actuator/health' with a trailing slash ignores the set cache time to live #45647

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

Closed
mvitz opened this issue May 23, 2025 · 1 comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@mvitz
Copy link
Contributor

mvitz commented 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 custom HealthIndicator that prints out a line every time it's invoked.

The Actuator documentation states within Configuring Endpoints:

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 23, 2025
@wilkinsona
Copy link
Member

This is expected and aligns with Framework's behavior around matching of trailing slashes. See #31563 for further background.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2025
@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels May 23, 2025
@philwebb 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants