From 56d807f9259cce3ddd05680971993c8d46870b19 Mon Sep 17 00:00:00 2001 From: coderkun Date: Tue, 6 May 2014 17:55:30 +0200 Subject: [PATCH] correct cache control for media --- controllers/MediaController.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/controllers/MediaController.inc b/controllers/MediaController.inc index 8916be90..ab297f75 100644 --- a/controllers/MediaController.inc +++ b/controllers/MediaController.inc @@ -62,8 +62,7 @@ // Set headers for caching control $response->addHeader("Pragma: public"); - $response->addHeader("Cache-control: public, max-age=".(60*60*24)); - $response->addHeader("Expires: ".gmdate('r', time()+(60*60*24))); + $response->addHeader("Cache-control: must-revalidate"); $response->addHeader("Date: ".gmdate(\DateTime::RFC822)); } @@ -302,7 +301,7 @@ $headerModifiedSince = $this->request->getServerParam('HTTP_IF_MODIFIED_SINCE'); $headerNoneMatch = $this->request->getServerParam('HTTP_IF_NONE_MATCH'); if( - !is_null($headerModifiedSince) && $fileLastModified < strtotime($headerModifiedSince) && + !is_null($headerModifiedSince) && strtotime($fileLastModified) <= strtotime($headerModifiedSince) && !is_null($headerNoneMatch) && $headerNoneMatch == $fileEtag ) { $this->response->setExit(true);