我們希望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