Firefox not honoring must-revalidate cache headers returned by jQuery.ajax() request

Posted by Oliver Weichhold on Stack Overflow See other posts from Stack Overflow or by Oliver Weichhold
Published on 2012-06-02T23:24:48Z Indexed on 2012/06/03 10:41 UTC
Read the original article Hit count: 178

Filed under:
|
|

UPDATE 1: Judging by this thread I am not the only one having this problem in FF 12 and only in 12.

UPDATE 2: The problem does not seem to be limited to Ajax requests. From the looks of it everything that makes it into Firefox 12's cache will be fetched from there. No matter what. The server can specify cache control headers all day long. Bummer!

What I'm trying to achieve is the following behavior:

  1. Browser may cache the response without revalidating for up to 5 minutes
  2. I don't care if the browser revalidates on every request (Both Chrome and IE9 do for example)
  3. When the expiration is up the browser MUST revalidate (which in my case will result in fresh data)

Chrome and IE9 exhibit the desired behavior when issuing a jquery.ajax() request with ifModified: true and cache: true while Firefox 12 never revalidates, which poses a serious problem.

These are the actual response headers:

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 03 Jun 2012 07:13:43 GMT
Content-Type: text/javascript; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: private, must-revalidate, max-age=300
Last-Modified: Sun, 03 Jun 2012 07:07:13 GMT
Content-Encoding: gzip

Any suggestions?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about http