我们希望Web服务器中包含敏感内容的所有响应返回下面的HTTP头:禁用浏览器缓存中的Tomcat 6
Cache-control:no-store
Pragma:no-cache.
我们使用Tomcat服务器版本6.0。
请建议我们必须在哪里进行更改。这样
我们希望Web服务器中包含敏感内容的所有响应返回下面的HTTP头:禁用浏览器缓存中的Tomcat 6
Cache-control:no-store
Pragma:no-cache.
我们使用Tomcat服务器版本6.0。
请建议我们必须在哪里进行更改。这样
Servlet过滤器应该有所帮助:
public class ResourceCacheFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
res.setHeader("Pragma", "no-cache");
chain.doFilter(request, response);
}
}
当我添加了这个并在web.xml中添加了过滤器url映射。但 <滤波器映射>
根据你要求其将设置标题您的安全限制,你可以设置tomcat的阀门有securePagesWithPragma为true(默认)。 请参阅Tomcat6 Valve Documentation进一步的细节,也Tomcat: Cache-Control
http://stackoverflow.com/questions/2563344/how-to-add-response-headers-based-on-content-type-getting-content-type- before-t – Mikaveli 2012-03-01 14:52:28