header nocache not working as expected

The header on my site script includes the following:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

These lines are called prior to any output/whitespace.

This is what is showing in my live header viewer:

POST /includes/whosonline.php HTTP/1.1
Host: mysite.org
User-Agent: Linux/Firefox 11
Accept: text/javascript, text/html, application/xml, text/xml, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.6.0.2
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: https://mysite.org?id=123
Content-Length: 0
Cookie: [cookie stuff removed]
Pragma: no-cache
Cache-Control: no-cache

Note that the headers of the script specify that the browser not cache the page. The Expires date is before the current date.

Why is this not working?

Answers


I just tested here with firefox and chrome (just in case) and it seems to be working!

  • OS: Mac OS X Lion
  • Server: Nginx 1.2
  • PHP: 5.3

http://cl.ly/041H1h1s1Q1P433W1m3Q

http://cl.ly/0o2B2I1a2N1I0N101E2w

My guesses: maybe your http server or php version has some kind of bug. So maybe, you should try to update both or test with another http server.


Need Your Help

javascript get selected html elements

javascript html dom

User is on a webpage , uses his mouse to select stuff, how can i use javascript to know what has been selected?