I'm having a peculiar problem:
PHP SCRIPT:
// checks If-Modified-Since header (if nothing has changed)
// Sends HTTP/1.0 304 Not Modified
// Sends Cache-control: public, must-revalidate
// exits
// if NO If-Modified-Since or something has changed
// builds content
// Sends Last-Modified: [DATE TIME]
// Sends Cache-control: public, must-revalidate
// exits
I am using jQuery AJAX to attempt to refresh the content on demand, I am trying to do this by altering the If-Modified-Since header with a DATE TIME in the past, using the "beforeSend" param.
This is currently what happens:
- Request is made, 200 OK response with fresh content
- Subsequent requests get a 304 response and browser pulls from cache
- CONTENT IS CHANGED on the server
- A request is made with modified If-Modified-Since header (no URL string altering), 200 OK response with fresh content
- Subsequent requests (without altering If-Modified-Since header) seems to retrieve old content from step #1
I guess im under the impression that at step #4, the browsers content should have been refreshed, what am i missing?
I setup a little test so you can try and see what i mean: http://tweetplenty.com/test/test2.php ... use FF and firebug if you can as im using console.log() ... here is the order of operations:
the "normal" link will do a request to http://tweetplenty.com/test/test.php without modifying if-modified-since ... subsequent requests using the "normal" link should return a 304 (it should return 200 OK every 60 seconds)
the "if-modified-since" link will do a request to http://tweetplenty.com/test/test.php WITH modified if-modified-since header, the browser will return new content.
clicking "normal" again at this point returns the previously cached data, I would think that it should have refreshed the data after clicking the "if-modified-since" link.
If you want to checkout the test scripts themselves here you go: http://tweetplenty.com/test/test.zip