Allow redirect cache visibility to be configured

This commit is contained in:
Alejandro Celaya
2025-07-21 10:02:36 +02:00
parent 13d9b7b0a7
commit 8b259b364d
8 changed files with 51 additions and 18 deletions

View File

@@ -20,7 +20,11 @@ readonly class RedirectResponseHelper implements RedirectResponseHelperInterface
{
$statusCode = $this->options->redirectStatusCode;
$headers = ! $statusCode->allowsCache() ? [] : [
'Cache-Control' => sprintf('private,max-age=%s', $this->options->redirectCacheLifetime),
'Cache-Control' => sprintf(
'%s,max-age=%s',
$this->options->redirectCacheVisibility,
$this->options->redirectCacheLifetime,
),
];
return new RedirectResponse($location, $statusCode->value, $headers);