When requesting content which is already cached, it doesn't send proper 403 Header. Which results empty content instead of the cached one.
Solved it by adding the code above in _display function in min controller:
if ($cache['statusCode'] == 304) {
header('Not Modified',true,304);
exit();
}
The full code of the function is:
private function display($files) {
# ci based cache
$cache_name = str_replace('/', '', $this->_request); // this is why we needed that request var
if (!$cache = $this->read_from_cache($cache_name)) {
$cache = $this->_minify($files);
$this->write_to_cache($cache_name, $cache);
}
if ($cache['statusCode'] == 304) {
header('Not Modified',true,304);
exit();
}
foreach ($cache['headers'] as $header => $value) {
// we don't want to display ETag
if ($header != 'ETag')
Header($header . ': ' . $value);
}
echo $cache['content'];
exit;
}
When requesting content which is already cached, it doesn't send proper 403 Header. Which results empty content instead of the cached one.
Solved it by adding the code above in _display function in min controller:
if ($cache['statusCode'] == 304) {
header('Not Modified',true,304);
exit();
}
The full code of the function is:
private function display($files) {
# ci based cache
$cache_name = str_replace('/', '', $this->_request); // this is why we needed that request var