• Brian Clozel's avatar
    Add spring.web.resources.cache.use-last-modified · f0a6128d
    Brian Clozel authored
    Prior to this commit, packaging a Spring Boot application as a container
    image with Cloud Native Buildpacks could result in unwanted browser
    caching behavior, with "Last-Modified" HTTP response headers pointing to
    dates in the far past.
    
    This is due to CNB resetting the last-modified date metadata for static
    files (for build reproducibility and container layer caching) and Spring
    static resource handling relying on that information when serving static
    resources.
    
    This commit introduces a new configuration property
    `spring.web.resources.cache.use-last-modified` that can be used to
    disable this behavior in Spring if the application is meant to run as a
    container image built by CNB.
    
    The default value for this property remains `true` since this remains
    the default value in Spring Framework and using that information in
    other deployment models is a perfectly valid use case.
    
    Fixes gh-24099
    f0a6128d
spring-boot-features.adoc 401 KB