summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-kernel/HttpCache/HttpCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-kernel/HttpCache/HttpCache.php')
-rw-r--r--vendor/symfony/http-kernel/HttpCache/HttpCache.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php
index 7c5a44f05b..8cc4b2108c 100644
--- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php
+++ b/vendor/symfony/http-kernel/HttpCache/HttpCache.php
@@ -165,7 +165,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
// FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism
if (HttpKernelInterface::MASTER_REQUEST === $type) {
$this->traces = array();
- $this->request = $request;
+ // Keep a clone of the original request for surrogates so they can access it.
+ // We must clone here to get a separate instance because the application will modify the request during
+ // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1
+ // and adding the X-Forwarded-For header, see HttpCache::forward()).
+ $this->request = clone $request;
if (null !== $this->surrogate) {
$this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy();
}