Note that there are some explanatory texts on larger screens.

plurals
  1. POFull page reload on Post/Redirect/Get ignoring cache control
    primarykey
    data
    text
    <p>I have a page that loads a lot of images, css and javascript. I've added a far future Expires header and set Cache-Control to public on these external dependencies so they should be cached. But every time I do a Post/Redirect/Get chrome tries to load these again. This behavior is very similar to reloading the page. I've added ETags and handle the If-None-Match header which helps a bit, but it still generates too many useless requests.</p> <p>How do I tell chrome and safari to get the files from cache?</p> <pre><code>chrome NOK safari NOK firefox OK ie OK </code></pre> <p>Also see <a href="http://www.google.com/support/forum/p/Chrome/thread?tid=72bf3773f7e66d68" rel="nofollow noreferrer">Full page reload on Post/Redirect/Get ignoring cache control</a> on the google support forum.</p> <p><strong>Clarification:</strong></p> <p>I don't want the browser to request <code>image1.png</code> twice. It should be cached.</p> <pre><code>200 GET page1.html 200 GET image1.png (Cache-Control: public, Expires and ETag) 302 POST action.asp (form submitted from page1.html, redirects) 200 GET page2.html 304 GET image1.png (If-None-Match) </code></pre> <p><strong>Example:</strong></p> <p>I've created a simple example to illustrate the problem.</p> <p><a href="http://crydust.be/lab/prg/" rel="nofollow noreferrer">http://crydust.be/lab/prg/</a></p> <p><strong>Headers:</strong></p> <p>The headers I send with the image are:</p> <pre><code>HTTP/1.1 200 OK Date: Fri, 18 Jun 2010 11:30:22 GMT Server: Apache Cache-Control: public, max-age=86400 Expires: Sat, 19 Jun 2010 11:30:24 GMT Etag: "123" Content-Length: 866 Content-Type: image/png </code></pre> <p>Which should make it cached for 24 hours. There is no Vary: * or anything like that.</p> <p><strong>Update:</strong> This behavior is now also present in Safari Mobile on iOS 4. A horible regression in page-load speed.</p> <p><strong>Update:</strong> There is a bugreport about this issue in the webkit bugzilla. <a href="https://bugs.webkit.org/show_bug.cgi?id=38690" rel="nofollow noreferrer">Bug 38690 - Submitting a POST that leads to a server redirect causes all cached items to redownload</a></p> <p><strong>Update:</strong> The problem persists on iOS 4.0.1</p> <p><strong>Update:</strong> The problem persists on iOS 4.1</p> <p><strong>Update:</strong> The problem persists on iOS 4.2</p> <p><strong>Update:</strong> The problem persists on iOS 4.2.1 and in Chrome from version 6 till 9.</p> <p><strong>Update:</strong> There is a bugreport about this issue in the Chromium project. (you can star it to show you care) <a href="http://code.google.com/p/chromium/issues/detail?id=68621" rel="nofollow noreferrer">Issue 68621: Post/Redirect/Get ignoring cache instructions</a> </p> <p><strong>Update:</strong> The problem persists on Chrome from version 6 till 10. It is now a 9 months old bug.</p> <p><strong>Update:</strong> The problem is fixed as of 2011-03-21 19:33:07 PST. This is reflected in the behavior of chrome 12 (canary).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload