How to enable browser caching on spring boot

I am trying to get spring boot by allowing static resources of browser cache. My resources are in the classpath under "static". When I look at the headers sent, I see that the headers of the modifications are fine-tuned, but 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 already saw this answer How to enable HTTP response caching in spring Boot , but this does not seem to apply to me, since I do not use spring-security, it is not in the classpath.

I am using spring-boot 1.4.0 with thimeleaf.

So, how can I let spring boot not include the Cache-Control header?

+4
1

, .

- :/static/assets. , :

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/static/assets/").setCacheControl(CacheControl.empty());
    }
}

, "no-store" spring -boot..

+2

Source: https://habr.com/ru/post/1652310/


All Articles