 core/lib/Drupal/Core/Messenger/LegacyMessenger.php             |  2 +-
 core/lib/Drupal/Core/Render/Element/StatusMessages.php         | 10 ++++++++--
 .../system/tests/modules/system_test/system_test.module        |  1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/lib/Drupal/Core/Messenger/LegacyMessenger.php b/core/lib/Drupal/Core/Messenger/LegacyMessenger.php
index 8c9751f..c9f2165 100644
--- a/core/lib/Drupal/Core/Messenger/LegacyMessenger.php
+++ b/core/lib/Drupal/Core/Messenger/LegacyMessenger.php
@@ -155,7 +155,7 @@ private function setMessage($message = NULL, $type = 'status', $repeat = FALSE)
       }
 
       // Mark this page as being uncacheable.
-      $this->killSwitch->trigger();
+//      $this->killSwitch->trigger();
     }
 
     // Messages not set when DB connection fails.
diff --git a/core/lib/Drupal/Core/Render/Element/StatusMessages.php b/core/lib/Drupal/Core/Render/Element/StatusMessages.php
index 530457f..86ec9be 100644
--- a/core/lib/Drupal/Core/Render/Element/StatusMessages.php
+++ b/core/lib/Drupal/Core/Render/Element/StatusMessages.php
@@ -73,11 +73,17 @@ public static function generatePlaceholder(array $element) {
    * @see drupal_get_messages()
    */
   public static function renderMessages($type) {
-    $render = [];
+    $render = [
+      '#cache' => [
+        'contexts' => [
+          'session',
+        ],
+      ],
+    ];
     $messages = drupal_get_messages($type);
     if ($messages) {
       // Render the messages.
-      $render = [
+      $render += [
         '#theme' => 'status_messages',
         // @todo Improve when https://www.drupal.org/node/2278383 lands.
         '#message_list' => $messages,
diff --git a/core/modules/system/tests/modules/system_test/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module
index 8173908..1bdb7c9 100644
--- a/core/modules/system/tests/modules/system_test/system_test.module
+++ b/core/modules/system/tests/modules/system_test/system_test.module
@@ -89,6 +89,7 @@ function system_test_page_attachments(array &$page) {
   // Used by FrontPageTestCase to get the results of
   // \Drupal::service('path.matcher')->isFrontPage().
   $frontpage = \Drupal::state()->get('system_test.front_page_output') ?: 0;
+  $page['#cache']['max-age'] = 0;
   if ($frontpage && \Drupal::service('path.matcher')->isFrontPage()) {
     drupal_set_message(t('On front page.'));
   }
