protected function DuplicateContentPreventionMiddleware::generateRedirectUrl in CDN 8.3
Generates a redirect URL for the given request.
Parameters
\Symfony\Component\HttpFoundation\Request $request: A request.
Return value
string The URL for the request.
1 call to DuplicateContentPreventionMiddleware::generateRedirectUrl()
- DuplicateContentPreventionMiddleware::getRedirectUrl in src/
StackMiddleware/ DuplicateContentPreventionMiddleware.php - Determines whether a redirect should be performed for the current request.
File
- src/
StackMiddleware/ DuplicateContentPreventionMiddleware.php, line 188
Class
- DuplicateContentPreventionMiddleware
- Redirects CDN user agents' requests for HTML to the canonical location.
Namespace
Drupal\cdn\StackMiddlewareCode
protected function generateRedirectUrl(Request $request) : string {
// Put the current request on the stack. We have to do this manually
// because this runs so early that the request stack is still empty.
// @see \Drupal\Core\StackMiddleware\KernelPreHandle::handle()
// @see \Drupal\Core\DrupalKernel::preHandle()
$this->requestStack
->push($request);
return Url::fromUri('base:' . $request
->getPathInfo())
->setAbsolute(TRUE)
->toString(FALSE);
}