 .../HtmlResponseBigPipeSubscriber.php                | 20 +++-----------------
 core/modules/big_pipe/src/Tests/BigPipeTest.php      |  8 ++++++++
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
index 31d1278..3e64ef2 100644
--- a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
+++ b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
@@ -24,14 +24,6 @@
 class HtmlResponseBigPipeSubscriber implements EventSubscriberInterface {
 
   /**
-   * Attribute name of the BigPipe response eligibility test result.
-   *
-   * @see onRespondEarly()
-   * @see onRespond()
-   */
-  const ATTRIBUTE_ELIGIBLE = '_big_pipe_eligible';
-
-  /**
    * The BigPipe service.
    *
    * @var \Drupal\big_pipe\Render\BigPipeInterface
@@ -55,12 +47,8 @@ public function __construct(BigPipeInterface $big_pipe) {
    *   The event to process.
    */
   public function onRespondEarly(FilterResponseEvent $event) {
-    // It does not make sense to have BigPipe responses for subrequests. BigPipe
-    // is never useful internally in Drupal, only externally towards end users.
     $response = $event->getResponse();
-    $is_eligible = $event->isMasterRequest() && $response instanceof HtmlResponse;
-    $event->getRequest()->attributes->set(self::ATTRIBUTE_ELIGIBLE, $is_eligible);
-    if (!$is_eligible) {
+    if (!$response instanceof HtmlResponse) {
       return;
     }
 
@@ -84,13 +72,11 @@ public function onRespondEarly(FilterResponseEvent $event) {
    *   The event to process.
    */
   public function onRespond(FilterResponseEvent $event) {
-    // Early return if this response was already found to not be eligible.
-    // @see onRespondEarly()
-    if (!$event->getRequest()->attributes->get(self::ATTRIBUTE_ELIGIBLE)) {
+    $response = $event->getResponse();
+    if (!$response instanceof HtmlResponse) {
       return;
     }
 
-    $response = $event->getResponse();
     $attachments = $response->getAttachments();
 
     // If there are no no-JS BigPipe placeholders, unwrap the scripts_bottom
diff --git a/core/modules/big_pipe/src/Tests/BigPipeTest.php b/core/modules/big_pipe/src/Tests/BigPipeTest.php
index b30d27b..9f7b26f 100644
--- a/core/modules/big_pipe/src/Tests/BigPipeTest.php
+++ b/core/modules/big_pipe/src/Tests/BigPipeTest.php
@@ -164,6 +164,10 @@ public function testBigPipe() {
     $this->pass('Verifying BigPipe assets are present…', 'Debug');
     $this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.');
     $this->assertTrue(in_array('big_pipe/big_pipe', explode(',', $this->getDrupalSettings()['ajaxPageState']['libraries'])), 'BigPipe asset library is present.');
+
+    // Verify that 4xx responses work fine. (4xx responses are handled by
+    // subrequests to a route pointing to a controller with the desired output.)
+    $this->drupalGet(Url::fromUri('base:non-existing-path'));
   }
 
   /**
@@ -209,6 +213,10 @@ public function testBigPipeNoJs() {
 
     $this->pass('Verifying BigPipe assets are absent…', 'Debug');
     $this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings and BigPipe asset library absent.');
+
+    // Verify that 4xx responses work fine. (4xx responses are handled by
+    // subrequests to a route pointing to a controller with the desired output.)
+    $this->drupalGet(Url::fromUri('base:non-existing-path'));
   }
 
   protected function assertBigPipeResponseHeadersPresent() {
