Reputation: 89
i want set disable browser cache(cache-control: no-cache, no-store, max-age=0) in spring boot.
my env
spring-boot: 2.1.2
spring-security: not use
i searched if i want to set response headers's cache-control: no-cache, just add at 'application.yml'.
like this
spring.resources.cache:
cachecontrol:
max-age: 0
no-cache: true
no-store: true
cache-private: true
or
spring.resources.chain.cache: false
but it does not worked.
i cant show cache-control header in my chrome browser's response headers.
in spring-framework, i just set
<mvc:mapping path="/**"/>
<bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="0"/>
<property name="useExpiresHeader" value="true"/>
<property name="useCacheControlHeader" value="true"/>
<property name="useCacheControlNoStore" value="true"/>
</bean>
</mvc:interceptor>
how to set disable browser cache in spring boot without spring security?
thank you.
Upvotes: 0
Views: 1765
Reputation: 874
try by adding this line in application.properties
spring.cache.type=NONE
Upvotes: 0