diff --git a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
index 4256c16..6746368 100644
--- a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
+++ b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
@@ -10,6 +10,7 @@
 use Drupal\Component\Datetime\DateTimePlus;
 use Drupal\Core\Routing\RequestContext;
 use Drupal\Core\Url;
+use Drupal\entity_test\Entity\EntityTest;
 use Drupal\simpletest\WebTestBase;
 use Drupal\Core\Cache\Cache;
 use Drupal\user\Entity\Role;
@@ -29,7 +30,7 @@ class PageCacheTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('test_page_test', 'system_test');
+  public static $modules = array('test_page_test', 'system_test', 'entity_test');
 
   protected function setUp() {
     parent::setUp();
@@ -308,6 +309,52 @@ function testPageCacheAnonymousRolePermissions() {
   }
 
   /**
+   * Tests the 4xx-response cache tag is added and invalidated.
+   */
+  function testPageCacheAnonymous403404() {
+    $admin_url = Url::fromRoute('system.admin');
+    $invalid_url = 'foo/' . $this->randomString();
+    $tests = [
+      403 => $admin_url,
+      404 => $invalid_url,
+    ];
+    foreach ($tests as $code => $content_url) {
+      // Anonymous user, without permissions.
+      $this->drupalGet($content_url);
+      $this->assertResponse($code);
+      $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
+      $this->assertCacheTag('4xx-response');
+      $this->drupalGet($content_url);
+      $this->assertResponse($code);
+      $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
+      $entity_values = array(
+        'name' => $this->randomMachineName(),
+        'user_id' => 1,
+        'field_test_text' => array(
+          0 => array(
+            'value' => $this->randomString(),
+            'format' => 'plain_text',
+          )
+        ),
+      );
+      $entity = EntityTest::create($entity_values);
+      $entity->save();
+      // Saving an entity clears 4xx cache tag.
+      $this->drupalGet($content_url);
+      $this->assertResponse($code);
+      $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
+      $this->drupalGet($content_url);
+      $this->assertResponse($code);
+      $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
+      // Rebuilding the router should invalidate the 4xx cache tag.
+      $this->container->get('router.builder')->rebuild();
+      $this->drupalGet($content_url);
+      $this->assertResponse($code);
+      $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
+    }
+  }
+
+  /**
    * Tests the omit_vary_cookie setting.
    */
   public function testPageCacheWithoutVaryCookie() {
