From 212437f1ad970b59f62200edf7ca3c28a8049ae0 Mon Sep 17 00:00:00 2001 From: Takashi Kanemoto Date: Fri, 12 Dec 2025 11:13:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20enable=20to=20set=20defau?= =?UTF-8?q?lt=20values=20for=20`stale-while-revalidate`=20and=20`stale-if-?= =?UTF-8?q?error`=20cache=20headers=20via=20config=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php | 2 ++ src/Symfony/Bundle/Resources/config/http_cache.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php b/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php index 3e1d3fff03f..de46a0aa664 100644 --- a/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php +++ b/src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php @@ -333,6 +333,8 @@ private function registerCommonConfiguration(ContainerBuilder $container, array $container->setParameter('api_platform.http_cache.shared_max_age', $config['defaults']['cache_headers']['shared_max_age'] ?? null); $container->setParameter('api_platform.http_cache.vary', $config['defaults']['cache_headers']['vary'] ?? ['Accept']); $container->setParameter('api_platform.http_cache.public', $config['defaults']['cache_headers']['public'] ?? $config['http_cache']['public']); + $container->setParameter('api_platform.http_cache.stale_while_revalidate', $config['defaults']['cache_headers']['stale_while_revalidate'] ?? null); + $container->setParameter('api_platform.http_cache.stale_if_error', $config['defaults']['cache_headers']['stale_if_error'] ?? null); $container->setParameter('api_platform.http_cache.invalidation.max_header_length', $config['defaults']['cache_headers']['invalidation']['max_header_length'] ?? $config['http_cache']['invalidation']['max_header_length']); $container->setParameter('api_platform.http_cache.invalidation.xkey.glue', $config['defaults']['cache_headers']['invalidation']['xkey']['glue'] ?? $config['http_cache']['invalidation']['xkey']['glue']); diff --git a/src/Symfony/Bundle/Resources/config/http_cache.php b/src/Symfony/Bundle/Resources/config/http_cache.php index 2bac73ec4f6..25035415201 100644 --- a/src/Symfony/Bundle/Resources/config/http_cache.php +++ b/src/Symfony/Bundle/Resources/config/http_cache.php @@ -25,5 +25,7 @@ '%api_platform.http_cache.shared_max_age%', '%api_platform.http_cache.vary%', '%api_platform.http_cache.public%', + '%api_platform.http_cache.stale_while_revalidate%', + '%api_platform.http_cache.stale_if_error%', ]); };