diff --git a/core/modules/page_cache/src/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php
index 3a031db..aa3319a 100644
--- a/core/modules/page_cache/src/StackMiddleware/PageCache.php
+++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php
@@ -284,8 +284,19 @@ protected function storeResponse(Request $request, Response $response) {
       }
     }
     else {
-      $date = $response->getExpires()->getTimestamp();
-      $expire = ($date > $request_time) ? $date : Cache::PERMANENT;
+      $max_age = $response->getCacheableMetadata()->getCacheMaxAge();
+      $expires_header = $response->getExpires()->getTimestamp();
+      // First check the expires header, respect that if set to a future date.
+      if ($expires_header > $request_time) {
+        $expire = $expires_header;
+      }
+      else {
+        // Fall back to checking the max age, which can either be unlimited, in
+        // which case it should be used as-is, a positive value for a certain
+        // expiration date or 0 if the page is not cacheable. 0 means that
+        // expire is the request time, which means it will not be cached below.
+        $expire = $max_age > Cache::PERMANENT ? $request_time + $max_age : Cache::PERMANENT;
+      }
     }
 
     if ($expire === Cache::PERMANENT || $expire > $request_time) {
