Fixing problems with JSP and caching proxy server

Written by Joseph Ottinger

Many of the proxy servers in use today are caching servers. These servers tend to recognize cgi, asp, and cfm as dynamic. They then always request a new page from the server rather than giving their client the page from the proxy cache. The problem is that most of these proxies do not recognize jsp as dynamic. To make matters worse, if the proxy server asks for the last modified date from the jsp page, it gets the compile date.

There is a simple fix for this. Add the following to your JSP pages where you have this problem.

<%!
// return current time to proxy server request
public long getLastModified(HttpServletRequest request) {
return System.currentTimeMillis();
}
%>

Copyright © 2007 IronFlare AB