Chromecaching302redirect

我有一个PHP脚本,用于在网站上旋转横幅图像。

在Firefox / IE页面刷新下将会有另一个请求和一个不同的图像被返回。

在Chrome浏览器下,请求似乎被caching,只有在新选项卡中打开页面才会实际查询脚本。

我相信这曾经工作在旧版本的铬,我已经尝试了几个不同types的redirect代码都具有相同的结果。

有小费吗?

<img class="banner" src="/inc/banner.php" alt="">

 ~$ cat /var/www/inc/banner.php <?php header("HTTP/1.1 302 Redirect"); header("Cache-Control: max-age=0, no-cache, no-store, must-revalidate"); //header('HTTP/1.1 307 Temporary Redirect'); //header("expires: none"); //header("expires: max"); //header("Cache-Control: public"); $folder = '../img/banner/'; $exts = 'jpg jpeg png gif'; $files = array(); $i = -1; if ('' == $folder) $folder = './'; $handle = opendir($folder); $exts = explode(' ', $exts); while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { // for each extension check the extension if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive $files[] = $file; // it's good ++$i; } } } closedir($handle); // We're not using it anymore mt_srand((double)microtime()*1000000); // seed for PHP < 4.2 $rand = mt_rand(0, $i); // $i was incremented as we went along header('Location: '.$folder.$files[$rand]); flush(); ?> 

curl输出;

 ~$ curl -I -k https://example.net/inc/banner.php HTTP/1.1 302 Redirect Server: nginx/1.1.14 Date: Fri, 24 Feb 2012 03:23:46 GMT Content-Type: text/html Connection: keep-alive X-Powered-By: PHP/5.3.10-1ubuntu1 Cache-Control: max-age=0, no-cache, no-store, must-revalidate Location: ../img/banner/2.jpg 

Chrome中的错误: http : //code.google.com/p/chromium/issues/detail? id= 103458

在我的主页上我有顶部的框架文件名是:banner.php它没有出现在谷歌浏览器,在所有其他browswer工作正常…我在代码中寻找错误的小时,然后我改变了文件名并从框架链接到mybanner.php,它也在谷歌浏览器工作!

符合W3C( http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3 )“ 如果caching控制或过期标头字段指示,此响应仅可caching ”。 尝试使用301“永久移动”