diff --git a/src/SymfonyCache/CustomTtlListener.php b/src/SymfonyCache/CustomTtlListener.php index 850fe184..8ee98f58 100644 --- a/src/SymfonyCache/CustomTtlListener.php +++ b/src/SymfonyCache/CustomTtlListener.php @@ -59,15 +59,16 @@ public function __construct($ttlHeader = 'X-Reverse-Proxy-TTL', $keepTtlHeader = public function useCustomTtl(CacheEvent $e) { $response = $e->getResponse(); - if (!$response->headers->has($this->ttlHeader)) { - return; - } $backup = $response->headers->hasCacheControlDirective('s-maxage') ? $response->headers->getCacheControlDirective('s-maxage') : 'false' ; $response->headers->set(static::SMAXAGE_BACKUP, $backup); - $response->setTtl($response->headers->get($this->ttlHeader)); + $response->setTtl( + $response->headers->has($this->ttlHeader) + ? $response->headers->get($this->ttlHeader) + : 0 + ); } /**