.../src/EventSubscriber/HtmlResponseBigPipeSubscriber.php | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
index b45adb3..2c644ee 100644
--- a/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
+++ b/core/modules/big_pipe/src/EventSubscriber/HtmlResponseBigPipeSubscriber.php
@@ -96,6 +96,21 @@ public function onRespond(FilterResponseEvent $event) {
$big_pipe_response->setContent($response->getContent());
$big_pipe_response->addCacheableDependency($response->getCacheableMetadata());
+ // A BigPipe response can never be cached, because it is intended for a
+ // single user.
+ // @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
+ $response->setPrivate();
+
+ // Inform surrogates how they should handle BigPipe responses:
+ // - "no-store" specifies that the response should not be stored in cache;
+ // it is only to be used for the original request
+ // - "content" identifies what processing surrogates should perform on the
+ // response before forwarding it. We send, "BigPipe/1.0", which surrogates
+ // should not process at all, and in fact, they should not even buffer it
+ // at all.
+ // @see http://www.w3.org/TR/edge-arch/
+ $response->headers->set('Surrogate-Control', 'no-store, content="BigPipe/1.0"');
+
// Add header to support streaming on NGINX + php-fpm (nginx >= 1.5.6).
$big_pipe_response->headers->set('X-Accel-Buffering', 'no');