[問題] 如何命令瀏覽器cache png檔案

作者: pttnews (PTT新聞)   2014-10-23 10:23:20
我有在filter 加入此行
if (StringUtils.lastIndexOfIgnoreCase(url, "png") == (url.length()-3) ||
StringUtils.lastIndexOfIgnoreCase(url, "jpg") == (url.length()-3) ||
StringUtils.lastIndexOfIgnoreCase(url, "gif") == (url.length()-3) ||
StringUtils.lastIndexOfIgnoreCase(url, "woff") == (url.length()-4))
{
(HttpServletResponse)response.setHeader("Cache-Control", "max-age=43200"); //HTTP 1.1
chain.doFilter(request, response);
}
封包內容如下

但是 firefox 的效能分析卻座落在快取未命中裡頭。

到底要怎麼做才會被 Firefox cache
作者: kentyeh (kent)   2014-10-23 16:32:00

Links booklink

Contact Us: admin [ a t ] ucptt.com