Skip to content

Commit bcb88b4

Browse files
authored
Merge pull request #8601 from kenjis/fix-duplicate-cache-control-header
fix: duplicate Cache-Control header with Session
2 parents fd28a3f + a30e130 commit bcb88b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

system/Config/Services.php

+6
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,12 @@ public static function session(?SessionConfig $config = null, bool $getShared =
690690
$session->setLogger($logger);
691691

692692
if (session_status() === PHP_SESSION_NONE) {
693+
// PHP Session emits the headers according to `session.cache_limiter`.
694+
// See https://www.php.net/manual/en/function.session-cache-limiter.php.
695+
// The headers are not managed by CI's Response class.
696+
// So, we remove CI's default Cache-Control header.
697+
AppServices::response()->removeHeader('Cache-Control');
698+
693699
$session->start();
694700
}
695701

0 commit comments

Comments
 (0)