Always add cache control headers
parent
a62f4babbf
commit
8abf6ae9cb
|
@ -143,6 +143,8 @@ class Controller
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_setCacheHeaders();
|
||||||
|
|
||||||
// output JSON or HTML
|
// output JSON or HTML
|
||||||
if ($this->_request->isJsonApiCall()) {
|
if ($this->_request->isJsonApiCall()) {
|
||||||
header('Content-type: ' . Request::MIME_JSON);
|
header('Content-type: ' . Request::MIME_JSON);
|
||||||
|
@ -177,6 +179,21 @@ class Controller
|
||||||
setcookie('lang', $lang, 0, '', '', true);
|
setcookie('lang', $lang, 0, '', '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Turn off browser caching
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function _setCacheHeaders()
|
||||||
|
{
|
||||||
|
// set headers to disable caching
|
||||||
|
$time = gmdate('D, d M Y H:i:s \G\M\T');
|
||||||
|
header('Cache-Control: no-store, no-cache, no-transform, must-revalidate');
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: ' . $time);
|
||||||
|
header('Last-Modified: ' . $time);
|
||||||
|
header('Vary: Accept');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store new paste or comment
|
* Store new paste or comment
|
||||||
|
@ -343,13 +360,6 @@ class Controller
|
||||||
*/
|
*/
|
||||||
private function _view()
|
private function _view()
|
||||||
{
|
{
|
||||||
// set headers to disable caching
|
|
||||||
$time = gmdate('D, d M Y H:i:s \G\M\T');
|
|
||||||
header('Cache-Control: no-store, no-cache, no-transform, must-revalidate');
|
|
||||||
header('Pragma: no-cache');
|
|
||||||
header('Expires: ' . $time);
|
|
||||||
header('Last-Modified: ' . $time);
|
|
||||||
header('Vary: Accept');
|
|
||||||
header('Content-Security-Policy: ' . $this->_conf->getKey('cspheader'));
|
header('Content-Security-Policy: ' . $this->_conf->getKey('cspheader'));
|
||||||
header('Cross-Origin-Resource-Policy: same-origin');
|
header('Cross-Origin-Resource-Policy: same-origin');
|
||||||
header('Cross-Origin-Embedder-Policy: require-corp');
|
header('Cross-Origin-Embedder-Policy: require-corp');
|
||||||
|
|
Loading…
Reference in New Issue