2

How does one force Firefox to not cache a response? We've tried:

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.

but in about:cache we still see:

Cache entry information
key:    http://myhost.my.domain.com:42133/ducc-servlet/timestamp
fetch count:    4
last fetched:    2013-03-04 09:21:40
last modified:    2013-03-04 09:12:53
expires:    1969-12-31 19:00:00
Data size:    24
file on disk:    none
Security:    This document does not have any security info associated with it.
Client:    HTTP
request-method:    GET
response-head:    HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Cache-Control: no-cache, no-store, must-revalidate 
Date: Sun, 03 Mar 2013 14:12:57 GMT 
Expires: Sun, 03 Mar 2013 14:12:57 GMT 
Content-Length: 24 
Server: Jetty(7.4.4.v20110707)

00000000:  32  30  31  33  2e  30  33  2e  30  34  20  30  39  3a  31  32  2013.03.04 09:12
00000010:  3a  35  36  20  4d  6f  6e  0a                                  :56 Mon.

Thanks.

Lou.

user2133121
  • 341
  • 1
  • 3
  • 12

1 Answers1

1

Firefox will always (unless it runs out of space) store the data in its cache, so that it can do things like view source, save as, etc by just pulling the data from the cache. It might not use it for normal page loads, of course, if the data was set "no-cache".

If the data is no-store, it will put the cache entry in memory, not on disk, as requested.

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
  • Thanks for your reply. When I say no-cache I mean it, but it seems that FF knows better. Chrome seems to listen better.In my FF cache I see multiple entries with the same key...how can that be? – user2133121 Mar 05 '13 at 11:29
  • The point of no-cache is that the data should not be used instead of asking the site. Firefox does that. It just happens to store the data for its own use. It could do that in a datastore distinct from the cache, but it happens to reuse the same data store.... Why exactly is this a problem? As for keys, I have no idea about the key setup in the Firefox cache, so I don't know what exactly you're seeing and why. – Boris Zbarsky Mar 05 '13 at 14:24
  • it's a problem on several accounts. first, there may be a very good reason for not asking for data to be in cache, such as it may be personal and an unknowing user may not flush his/her cache before stepping away from the browser. second, it's using space unnecessarily that could be used in a more useful way. third, it seems to be keeping multiple copies of the same data, thus using even more space than is necessary. and last, that's not what i asked for - i don't want this data cached. how do i convey to FF my desires and have them carried out? btw, chrome behaves quite nicely, thank you. – user2133121 Mar 05 '13 at 15:54
  • with respect to duplicate keys, i issue about:cache and scroll/search and see the same exact key repeated multiple times. – user2133121 Mar 05 '13 at 15:58
  • It's not using space unnecessarily: the browser plans to make use of the data for save as or view source as needed. I think you completely misunderstand how caching directives work. They describe what should happen with the data from the HTTP point of view. They tell you nothing about whether the browser has the data in some other form (e.g. being rendered as a web page!) – Boris Zbarsky Mar 05 '13 at 20:30
  • we seem to disagree. but we digress. the problem to be solved is that (under FF only) large amounts of virtual storage are being consumed (due to caching data) and i want to stop that from happening. what directive do i use to limit the amount of storage used by FF when visiting my site. again, no problems with chrome using the directives mentioned above. – user2133121 Mar 06 '13 at 13:14
  • You can't affect the amount of its own storage Firefox uses for its own purposes using HTTP headers. – Boris Zbarsky Mar 06 '13 at 15:37