diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php
index 1629c14..b0cdf71 100644
--- a/core/modules/page_cache/src/StackMiddleware/PageCache.php
+++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php
@@ -222,9 +222,16 @@ protected function fetch(Request $request, $type = self::MASTER_REQUEST, $catch
       return $response;
     }
 
-    // Use the actual timestamp from an Expires header, if available.
-    $date = $response->getExpires()->getTimestamp();
-    $expire = ($date > time()) ? $date : Cache::PERMANENT;
+    // Use the #cache['max-age'] if available.
+    if ($response instanceof CacheableResponseInterface) {
+      $max_age = $response->getCacheableMetadata()->getCacheMaxAge();
+      $expire = ($max_age !== Cache::PERMANENT) ? time() + $max_age : Cache::PERMANENT;
+    }
+    else {
+      // Use the actual timestamp from an Expires header, if available.
+      $date = $response->getExpires()->getTimestamp();
+      $expire = ($date > time()) ? $date : Cache::PERMANENT;
+    }
 
     $tags = explode(' ', $response->headers->get('X-Drupal-Cache-Tags'));
     $this->set($request, $response, $expire, $tags);
