Note that there are some explanatory texts on larger screens.

plurals
  1. POChrome is caching an HTTP PUT request
    primarykey
    data
    text
    <p>I have this bizarre issue with Chrome. It quite often appears to cache PUT requests.</p> <p><strong>The Details:</strong> I have an app using backbone.js and when trying to persist some changes to a model (backbone automatically generates a PUT request), Chrome just wont send that request to the server. It works perfectly fine in Firefox and IE (haven't seen the issue in Safari so far).</p> <p>Here's a screenshot from the Chrome developer tools' Network tab. As you can see, the response for the PUT request is being returned from cache (the request doesn't hit the server!!) <img src="https://i.stack.imgur.com/p4RQt.png" alt="Chrome caches PUT request"></p> <p>Here's a screenshot of the header details of that same request. Once again, it's evident that Chrome doesn't bother sending the PUT request to the server. <img src="https://i.stack.imgur.com/FL2F3.png" alt="Chrome cached PUT request header"></p> <p>The payload of the request is JSON data. Any thoughts as to why this is happening / what I'm doing wrong?</p> <p><strong>UPDATE:</strong> Chromium has confirmed that this is indeed a <a href="http://code.google.com/p/chromium/issues/detail?id=136320" rel="noreferrer">bug on it's end</a> (thanks Jan Hančič).</p> <p><strong>TEMPORARY SOLUTION</strong> I ended up overriding <code>Backbone.sync</code> method and appending a timestamp to the querystring of PUT, POST and DELETE requests so that they are always unique:</p> <pre><code>if(!options.data &amp;&amp; model &amp;&amp; (method == 'create' || method == 'update' || method == 'delete')) { params.url += (params.url.indexOf('?') == -1 ? '?' : '&amp;') + '_=' + new Date().getTime(); } </code></pre>
    singulars
    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