summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-29 21:52:42 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-29 21:52:42 -0700
commit02b46833d60b462b70e3b00d6712059cc3547809 (patch)
tree15b0cdb5aa692de31eb649adaaece9a94be29cc0
parent3a260ed3f74a7db6484a39c4d2ac25fb12a5626e (diff)
Pass back Cache-Control and Expires headers when we send back a 304,
otherwise some browsers (Firefox, at least) thinks that it needs to revalidate. At least in my case, it appears that my proxy tacks on restrictive Cache-Control headers if they aren't there.
-rw-r--r--modules/gallery/controllers/combined.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
index 58ed85d0..49a54f24 100644
--- a/modules/gallery/controllers/combined.php
+++ b/modules/gallery/controllers/combined.php
@@ -45,6 +45,9 @@ class Combined_Controller extends Controller {
// Our data is immutable, so if they already have a copy then it needs no updating.
if ($input->server("HTTP_IF_MODIFIED_SINCE")) {
header('HTTP/1.0 304 Not Modified');
+ header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
+ header("Cache-Control: max-age=2678400");
+ header('Pragma: public');
return;
}
@@ -60,7 +63,6 @@ class Combined_Controller extends Controller {
(strpos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false);
if ($use_gzip && $content = $cache->get("{$key}_gz")) {
header("Content-Encoding: gzip");
- header("Cache-Control: public");
} else {
// Fall back to non-gzipped if we have to
$content = $cache->get($key);
@@ -73,6 +75,8 @@ class Combined_Controller extends Controller {
// $type is either 'javascript' or 'css'
header("Content-Type: text/$type; charset=UTF-8");
header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
+ header("Cache-Control: max-age=2678400");
+ header('Pragma: public');
header("Last-Modified: " . gmdate("D, d M Y H:i:s T", time()));
Kohana::close_buffers(false);