From 64c461fcb9b4738e3967e98d2011610c967de2c4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 2 Mar 2024 21:50:50 +0900 Subject: [PATCH 1/2] fix: duplicate Cache-Control header with Session --- system/Config/Services.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/Config/Services.php b/system/Config/Services.php index 5ffb9e049c46..4ee5c4982e3c 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -690,6 +690,12 @@ public static function session(?SessionConfig $config = null, bool $getShared = $session->setLogger($logger); if (session_status() === PHP_SESSION_NONE) { + // PHP Session emits the headers according to `session.cache_limiter`. + // See https://www.php.net/manual/en/function.session-cache-limiter.php. + // The headers are not managed by the CI's Response class. + // So removes the CI's default Cache-Control header. + AppServices::response()->removeHeader('Cache-Control'); + $session->start(); } From a30e130cc72ede47f1a7ad70aea2ef9631e080ad Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 5 Mar 2024 14:03:35 +0900 Subject: [PATCH 2/2] docs: fix by proofreading Co-authored-by: John Paul E. Balandan, CPA --- system/Config/Services.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Config/Services.php b/system/Config/Services.php index 4ee5c4982e3c..738809b44595 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -692,8 +692,8 @@ public static function session(?SessionConfig $config = null, bool $getShared = if (session_status() === PHP_SESSION_NONE) { // PHP Session emits the headers according to `session.cache_limiter`. // See https://www.php.net/manual/en/function.session-cache-limiter.php. - // The headers are not managed by the CI's Response class. - // So removes the CI's default Cache-Control header. + // The headers are not managed by CI's Response class. + // So, we remove CI's default Cache-Control header. AppServices::response()->removeHeader('Cache-Control'); $session->start();