PDA

View Full Version : cacheSeconds = 0 doesn't work in Mozilla Suite/Firefox



sds
Sep 21st, 2004, 05:08 AM
When I set my Controller to
cacheSeconds = 0
and press the back button in IE, IE reloads the page nicely.

However, in Firefox or Mozilla Suite, pressing the back button doesn't issue a reload. I've tried to set the Cache-control to no-cache, must-revalidate by setting it in my the controller or to 1 second, but to no avail.

Nothing found in the bug database of Mozilla.
Anybody any clues ?

Here's the dump of the HTTP response of the server:
HTTP/1.1 200 OK
Server: Resin/3.0.8
Pragma: No-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Content-Language: nl-BE
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Tue, 21 Sep 2004 09:04:25 GMT

dwsmith75
Nov 5th, 2004, 07:21 AM
from: http://www.theserverside.com/news/thread.tss?thread_id=29758#144899


Mozilla/Firefox does not reload page marked "no-cache", if a user goes back in the browser session history.

Mozilla/Firefox reloads a page marked "no-store", if a user goes back in the history. This behavior is "as designed" for Mozilla, but have been broken for a while and was recently fixed in Firefox 1.0 RC (see Mozilla bug 252023).

Pages which are marked as "no-cache", but which are served over SSL, are always reloaded by Mozilla.

MSIE reloads a page in all aforementioned cases.

If you want to keep your pages in sync with Model while using Mozilla, you need to mark your responses as "no-store". Struts has the convenient setting <controller nocache="true"/> in struts-config.xml file, but it does not set "no-store" header, it sets only the following headers:

response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);

sds
Nov 5th, 2004, 07:57 AM
Thanks, just read the article too 8)

dwsmith75
Nov 5th, 2004, 08:33 AM
Now, what I have to find a possible method to override to add no-store to response header for GET and POST with the least amount of trouble

klr8
Nov 5th, 2004, 09:27 AM
Maybe this should be reported as a bug in Jira?

Also note the following (quoted from section 13.13 - ah what a number :) - of ftp://ftp.isi.edu/in-notes/rfc2616.txt):


User agents often have history mechanisms, such as "Back" buttons and
history lists, which can be used to redisplay an entity retrieved
earlier in a session.

History mechanisms and caches are different. In particular history
mechanisms SHOULD NOT try to show a semantically transparent view of
the current state of a resource. Rather, a history mechanism is meant
to show exactly what the user saw at the time when the resource was
retrieved.


So in general you can't really solve the problem since using the back button accesses the browser history which means it is not required to refresh the page. As far as I know Opera implements this very strictly.

Erwin

dwsmith75
Nov 5th, 2004, 09:38 AM
oh the joys of web-based development, what browser will actually get everything right....