summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
authorUrban Müller2014-08-26 19:15:57 +0200
committerUrban Müller2014-08-26 19:15:57 +0200
commitd4aeaef63c366dc1d5e147d777f1c04d8d5aae57 (patch)
treea6b0f26d5cbab50b7df2736854f6f089f226ea00 /itjs.php
parent4d919c48d99d3ec3efcff01d37749e75071314e2 (diff)
downloaditools-d4aeaef63c366dc1d5e147d777f1c04d8d5aae57.tar.gz
itools-d4aeaef63c366dc1d5e147d777f1c04d8d5aae57.tar.bz2
itools-d4aeaef63c366dc1d5e147d777f1c04d8d5aae57.zip
30 day expire if checksum is present
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/itjs.php b/itjs.php
index 3fc5441..32267da 100644
--- a/itjs.php
+++ b/itjs.php
@@ -65,12 +65,13 @@ else if (!it::match('\.html$', $file))
header("Content-Type: application/x-javascript; charset=$charset");
}
-@header("Etag: alwaysvalid");
+@header("Etag: alwaysvalid"); # we have checksums in the url. client should always keep the version he downloaded along with the html
if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && it::is_live() && !$_REQUEST['retry'])
{
- header("Cache-Control: max-age=604800, private"); # proxies should not cache since contents of same url can differ between browsers
- header("Expires: " . gmdate("D, d M Y H:i:s", time()+604800). " GMT");
+ $keeptime = $_REQUEST['s'] || $_REQUEST['c'] ? 86400*30 : 900; # long expire if checksum present
+ header("Cache-Control: max-age=$keeptime, private"); # proxies should not cache since contents of same url can differ between browsers
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $keeptime). " GMT");
}
$data = itjs::strip($data);