I'm trying to get spring boot let the browser cache static resources. My resources are located in the classpath under "static". When I look at the headers sent back, I see the modification headers being set fine, but somehow the header "Cache-Control: no-store" is also added.
HTTP/1.1 200
Last-Modified: Wed, 24 Aug 2016 08:50:16 GMT
Cache-Control: no-store
Accept-Ranges: bytes
Content-Type: text/css
Content-Length: 434554
Date: Wed, 24 Aug 2016 09:42:42 GMT
I have already seen this answer How to enable HTTP response caching in Spring Boot, but this doesn't seem to apply to me as I am not using spring-security, it is not on the classpath.
I am using spring-boot 1.4.0 with thymeleaf.
So, how do I let spring boot not include the Cache-Control header?
Turns out it is fairly easy to resolve.
The directory structure is classpath:/static/assets. To have no cache-control header added to the responds, add this class:
It still baffled me that "no-store" is the default with spring-boot..
At least in recent (2018) versions of SpringBoot, there are properties you can set:
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html