我正在尝试将Tomcat 7的Cache Control
设置为no-cache
选项。
我尝试使用ExpiresFilter
中的web.xml
,如下所示:
<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 0 seconds</param-value>
</init-param>
<init-param>
<param-name>ExpiresByType text/css</param-name>
<param-value>access plus 0 seconds</param-value>
</init-param>
<init-param>
<param-name>ExpiresByType application/javascript</param-name>
<param-value>access plus 0 seconds</param-value>
</init-param>
<init-param>
<param-name>ExpiresDefault</param-name>
<param-value>access plus 0 seconds</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ExpiresFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
然而,当我阅读我的回复标题时,我得到的是:
Cache-Control:max-age=0
而不是Cache-Control: no-cache
。
如何将Tomcat服务器设置为仅通过配置文件指定Cache-Control: no-cache
?