2017-03-15 3 views
0

브라우저 캐시에 정적 리소스를 넣으려고합니다. ExpiresFilter에 대해 알아야했기 때문에 배포 디스크립터에서 아래처럼 구성했습니다.브라우저에서 정적 리소스를 캐시하는 방법

<filter> 
    <filter-name>ExpiresFilter</filter-name> 
    <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class> 
    <init-param> 
     <param-name>ExpiresByType image</param-name> 
     <param-value>access plus 2 weeks</param-value> 
    </init-param> 
    <init-param> 
     <param-name>ExpiresByType text/css</param-name> 
     <param-value>access plus 2 weeks</param-value> 
    </init-param> 
    <init-param> 
     <param-name>ExpiresByType application/javascript</param-name> 
     <param-value>access plus 2 weeks</param-value> 
    </init-param> 
</filter> 

    <filter-mapping> 
    <filter-name>ExpiresFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>REQUEST</dispatcher> 
</filter-mapping> 

하지만 난 말 정적 리소스를 볼 때 main.css가 응답 헤더 그래서

Accept-Ranges:bytes 
Cache-Control:no-cache, no-store, max-age=0, must-revalidate 
Content-Length:47146 
Content-Type:text/css 
Date:Wed, 15 Mar 2017 10:34:09 GMT 
ETag:W/"47146-1489142922357" 
Expires:0 
Last-Modified:Fri, 10 Mar 2017 10:48:42 GMT 
Pragma:no-cache 
Server:Apache-Coyote/1.1 
X-Content-Type-Options:nosniff 
X-Frame-Options:DENY 
X-XSS-Protection:1; mode=block 

아래는 이유가 될 수 브라우저 cache.What에 저장되지처럼?

+0

추가 세부 정보가 필요하면 알려주세요. – Kasyap

답변

0

내 응용 프로그램에서 스프링 보안을 사용하고 있기 때문에 이런 일이 발생합니다. 따라서 스프링 보안에서 캐시 제어 헤더를 비활성화 한 후 응답 헤더를 무시하고 있습니다.

관련 문제