diff --git a/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php b/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php index 3cbbd5a..806975e 100644 --- a/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -362,7 +362,10 @@ public function generateFromRoute($name, $parameters = array(), $options = array $port = ':' . $this->context->getHttpsPort(); } if ($collect_bubbleable_metadata) { - $generated_url->addCacheContexts(['url.site']); + $request = $this->requestStack()->getCurrentRequest(); + if ($request->isMethodSafe()) { + $generated_url->addCacheContexts(['url.site']); + } } $url = $scheme . '://' . $host . $port . $base_url . $path . $fragment; return $collect_bubbleable_metadata ? $generated_url->setGeneratedUrl($url) : $url;