Fix #2167 allow removing no-store and must-revalidate from Cache-Control headers

This commit is contained in:
Kijin Sung 2023-08-31 02:19:18 +09:00
parent 35dec01ab0
commit 15648d10d1
6 changed files with 29 additions and 1 deletions

View file

@ -481,9 +481,11 @@ class Context
*/
public static function setCacheControl($ttl = 0, $public = true)
{
$cache_control_header = config('cache.cache_control') ?? 'must-revalidate, no-store, no-cache';
if($ttl == 0)
{
header('Cache-Control: ' . ($public ? '' : 'private, ') . 'must-revalidate, no-store, no-cache');
header('Cache-Control: ' . ($public ? '' : 'private, ') . $cache_control_header);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
}