diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5841fc2..f20334b 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -723,9 +723,6 @@ function drupal_process_attached(array $elements) {
         case 'html_head_link':
           call_user_func_array('_drupal_add_html_head_link', $args);
           break;
-        case 'http_header':
-          call_user_func_array('_drupal_add_http_header', $args);
-          break;
         default:
           throw new \LogicException(sprintf('You are not allowed to use %s in #attached', $callback));
       }
diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
index 157454d..8e10c2a 100644
--- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
@@ -116,23 +116,6 @@ public function onRespond(FilterResponseEvent $event) {
     // https://www.owasp.org/index.php/List_of_useful_HTTP_headers
     $response->headers->set('X-Content-Type-Options', 'nosniff', FALSE);
 
-    // Attach globally-declared headers to the response object so that Symfony
-    // can send them for us correctly.
-    // @todo Remove this once drupal_process_attached() no longer calls
-    //    _drupal_add_http_header(), which has its own static. Instead,
-    //    _drupal_process_attached() should use
-    //    \Symfony\Component\HttpFoundation\Response->headers->set(), which is
-    //    already documented on the (deprecated) _drupal_process_attached() to
-    //    become the final, intended mechanism.
-    $headers = drupal_get_http_header();
-    foreach ($headers as $name => $value) {
-      // Symfony special-cases the 'Status' header.
-      if ($name === 'status') {
-        $response->setStatusCode($value);
-      }
-      $response->headers->set($name, $value, FALSE);
-    }
-
     // Apply the request's access result cacheability metadata, if it has any.
     $access_result = $request->attributes->get(AccessAwareRouterInterface::ACCESS_RESULT);
     if ($access_result instanceof CacheableDependencyInterface) {
diff --git a/core/modules/views/src/EventSubscriber/HTTPStatusCodeListener.php b/core/modules/views/src/EventSubscriber/HTTPStatusCodeListener.php
new file mode 100644
index 0000000..35234c9
--- /dev/null
+++ b/core/modules/views/src/EventSubscriber/HTTPStatusCodeListener.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\views\Plugin\views\area\HTTPStatusCode.
+ */
+
+namespace Drupal\views\EventSubscriber;
+
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
+use Symfony\Component\HttpKernel\KernelEvents;
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * An event subscriber to change the HTTP status code.
+ *
+ * Used by the 'http_status_code' view.
+ *
+ * @see \Drupal\views\Plugin\views\area\HTTPStatusCode
+ */
+class HTTPStatusCodeListener implements EventSubscriberInterface {
+
+  protected $statusCode;
+
+  /**
+   * Constructor for this subscriber.
+   *
+   * @param int $status_code
+   *   The HTTP status code for this request.
+   */
+  public function __construct($status_code) {
+    $this->statusCode = $status_code;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getSubscribedEvents() {
+    $events[KernelEvents::RESPONSE][] = array('onRespond');
+    return $events;
+  }
+
+  /**
+   * Change the HTTP status code when the response is generated by the kernel.
+   *
+   * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
+   *   The event we're responding to.
+   */
+  public function onRespond(FilterResponseEvent $event) {
+    if ($event->isMasterRequest()) {
+      $event->getResponse()->setStatusCode($this->statusCode);
+    }
+  }
+
+}
diff --git a/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php b/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php
index 036e369..bdb4b34 100644
--- a/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php
+++ b/core/modules/views/src/Plugin/views/area/HTTPStatusCode.php
@@ -8,7 +8,10 @@
 namespace Drupal\views\Plugin\views\area;
 
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\views\EventSubscriber\HTTPStatusCodeListener;
+use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher;
 use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Alter the HTTP response status code used by the view.
@@ -20,6 +23,45 @@
 class HTTPStatusCode extends AreaPluginBase {
 
   /**
+   * The event dispatcher we'll use to change the status code of the response.
+   *
+   * @var Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
+   */
+  protected $eventDispatcher;
+
+  /**
+   * Override the constructor so we can inject the event dispatcher.
+   *
+   * @param ContainerAwareEventDispatcher $event_disaptcher
+   *   Event dispatcher service.
+   * @param array $configuration
+   *   A configuration array containing information about the plugin instance.
+   * @param string $plugin_id
+   *   The plugin_id for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   *
+   * @see \Drupal\views\Plugin\views\HandlerBase::__construct
+   */
+  public function __construct(ContainerAwareEventDispatcher $event_disaptcher, array $configuration, $plugin_id, $plugin_definition) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->eventDispatcher = $event_disaptcher;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    $http_status_code = new static(
+      $container->get('event_dispatcher'),
+      $configuration,
+      $plugin_id,
+      $plugin_definition
+    );
+    return $http_status_code;
+  }
+
+  /**
    * {@inheritdoc}
    */
   protected function defineOptions() {
@@ -62,10 +104,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
   /**
    * {@inheritdoc}
    */
-  function render($empty = FALSE) {
+  public function render($empty = FALSE) {
     if (!$empty || !empty($this->options['empty'])) {
-      $build['#attached']['http_header'][] = ['Status', $this->options['status_code']];
-      return $build;
+      // Add an event subscriber so it will change the status code when the
+      // response object is ready.
+      $this->eventDispatcher->addSubscriber(new HTTPStatusCodeListener($this->options['status_code']));
     }
   }
 
