You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mangano <jo...@pslgroup.com> on 2003/03/30 23:21:36 UTC

Caching problem with sendRedirect

I appear to be having a problem with caching when using sendRedirect.

I have two filters:
The first creates/loads a user profile and stores it in the session.
The second checks to see if the user profile id is contained in the query string, if not it uses a sendRedirect to the same url but with the user profile id in the query string. This only happens the first time the user hits the site as all subsequent links contain the user profile id in the href.

My problem is that the when the redirect occurs, if the page has been viewed before, the browser does loads the page from its cache no matter what I put in the response header. I have tried the following in the response to stop it caching:

response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("max-age", 0);
response.setDateHeader("Expires", 0);

Yet if I hit the same page, but avoid the sendRedirect by including the user id in the url, the page is not loaded from the browser cache. This occurs for both IE6 and Mozilla 1.2.

This is causing me grief for my web logging. Is there something in the sendRedirect HTTP header that I am missing or is this normal behaviour?

Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org