如何为具有Https / SSL的Tomcat 8.0.14启用浏览器缓存

时间:2016-09-06 12:28:44

标签: java tomcat ssl

我在Tomcat /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 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>

以下代码添加在Tomcat /context.xml

<context cachingallowed="true" crosscontext="true" debug="5"
     path="/jasperserver-pro" reloadable="false">
<valve classname="org.apache.catalina.authenticator.BasicAuthenticator"
       disableproxycaching="false" securepageswithpragma="true">

</valve>
</context>

此代码适用于本地但在具有Https / SSL的WEB SERVER上。 有朋友可以帮帮我吗?

提前感谢您的回复。

0 个答案:

没有答案