我们有一个应用程序,允许用户添加/编辑/替换/删除内容(文字,图片,SWF文件,MP3音乐等)。 我们希望管理员总是使用no-cache标题有最新更新的文件,当用户运行应用程序时,一切变得/使用缓存。
我已经调查方案,并使用HTML元标签,如曾尝试:
<meta http-equiv="expires" content="0" />
<meta http-equiv="cache-control" content="no-cache, no-store" />
<meta http-equiv="pragma" content="no-cache" />
但是,这似乎并没有得到很好的解决,因为这发生在创建头之后,不改变媒体(图像,SWF文件,MP3音乐等)的头。
我想使用Apache设置页眉和跨越这个代码来到这个网站 :
<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
这似乎是,当我们需要它的缓存之间很好的解决方案,但是唯一真正的区别,当它不应该被缓存是URL(preview.jsp VS run.jsp),所以我们不能按文件类型匹配它因为大多数的文件是相同的。
有没有人有这种类型的场景好的解决办法?
谢谢。
编辑:
Preview.jsp和run.jsp基本上是相同的只是用不同的JSP和JS处理。 他们通过iframe相同的内容和媒体的读取。 例如,他们每个样子:
<%
//Some JSP
%>
/* HTML Headers, JS, ETC */
<iframe id="contentFrame" seamless="1" src="http://somedomain.com/template.html"></iframe>
/* End HTML */
preview.jsp和run.jsp出现在同一目录下,并使用所有相同的资源。 我在寻找一个解决方案有preview.jsp不缓存内容和run.jsp缓存的东西。
服务器设置与Apache Tomcat上。