leodutra
4/29/2015 - 9:14 PM

Cache - Control, Pragma, Expires, must-revalidate, no-store, no-cache Stuff (force)

Cache - Control, Pragma, Expires, must-revalidate, no-store, no-cache Stuff (force)

<%-- https://www.mnot.net/cache_docs/ --%>
<%-- http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/ --%>
<%-- http://stackoverflow.com/a/18516720/1260526 --%>
<%-- https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching --%>
<%-- http://stackoverflow.com/questions/18148884/difference-between-no-cache-and-must-revalidate --%>
<%-- http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers --%>


<meta http-equiv="Cache-Control" content="no-store, must-revalidate" />
<%--OPTIONS most badly, see http://stackoverflow.com/a/18516720/1260526 
  no-cache, no-store, must-revalidate, proxy-revalidate, max-age=0, s-max-age=0
--%>
<%--meta http-equiv="Pragma" content="no-cache" (bad, see: http://stackoverflow.com/a/18516720/1260526) --%>
<%--meta http-equiv="Expires" content="0" (bad, see: http://stackoverflow.com/a/18516720/1260526) --%>

<%   
  //response.setDateHeader ("Expires", 0);  (bad, see: http://stackoverflow.com/a/18516720/1260526)
  //response.setHeader("Pragma","no-cache"); (bad, see: http://stackoverflow.com/a/18516720/1260526)
  if (request.getProtocol().equals("HTTP/1.1")){  
   response.setHeader("Cache-Control","no-store, must-revalidate");   
  }
  else {
    response.setHeader("Pragma","no-cache");
	  response.setDateHeader ("Expires", -1);
%>
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="expires" content="-1" />
<%     
  }
%>