Friday 15 July 2011

javascript - XMLHttpRequest calls do not include If-Modified-Since header -


I have a simple caching mechanism on the server, which sets the recommended last-modified header And this also responds to the if-modified-to- header is a sample of the response headings:

  Date: Tuesday, March 17, 2015 20:40:14 GMT Last modified: Mon, 16 Mar 2015 09:47:28 GMT  

Once navigated to the page, is included in the browser and if-modified-from < / Code> Aniro Header and broke correctly with 304 status response.

However, when I request using jQuery (and this behavior remains for a simple XMLHttpRequest) if-modified-from header is not sent.

Simple code to reproduce it:

  var xhr = new XMLHttpRequest (); Xhr.open ("get", "http: //localhost/some/page.html", true); Xhr.send ();  

Such code always generates 200 responses, even if it was previously cached. I've seen it in Firefox 36 and Chromium 41.

Why is not header included in calls generated from XMLHttpRequest?

It seems that this was a user error because I can not reproduce it.


No comments:

Post a Comment