Skip to content

Support caching of endpoint responses when the request has a principal #19538

@edmundham

Description

@edmundham

Problem
Health endpoint's cache time to live property is not working when there is a live session (when the user is authenticated using spring security)
This is a similar issue with #13238, however this time, TTL is not working only when there is an user logged in (authenticated)

Environment
Java 1.8
Spring-Boot 2.1.11

Expected Behaviour
Health endpoint's cache time to live property should be standalone, not affected by user being authenticated or not

Step to Reproduce

  1. ./mvnw spring-boot:run to spin up the application
  2. First, access localhost:8080/demo/health and keep refresh to see health TTL is working properly. (timestamp should be updated every 10 seconds as cache.time-to-live property is set to 10 seconds)
  3. Access localhost:8080/demo/test in the browser, login with username: user & password: password
  4. Then, open the other tab on the browser and access localhost:8080/demo/health
  5. Timestamp field is updated every time you hit refresh

Sample application
demo.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions