Redirects to url of referer

@throws CannotRedirectToEmptyRefererUrlException
@return RedirectResponse
485238
protected function redirectToReferer(): RedirectResponse
    {
        $url = $this->requestService->fetchRefererUrl();

        // Oops, url of referer is unknown
        if ('' === $url) {
            throw CannotRedirectToEmptyRefererUrlException::create();
        }

        return $this->redirect($url);
    }
525109
public function getResponse()
    {
        $response = redirect()->to($this->getRedirectUrl());
        $response->withInput($this->request->input());
        $response->withErrors($this->getErrors(), 'default');
        $response->setCharset(config('app.charset', 'UTF-8'));

        return $response;
    }
651570
public function redirectToReferrer(string $defaultRoute = null): RedirectResponse
    {
        $request = $this->get('request_stack')->getCurrentRequest();

        return $this->redirectToFirstValidRoute([
            $request->headers->get('referer'),
            $defaultRoute,
        ]);
    }
900837
public function getRedirectUrl()
    {
        // Build the request
        $id = $this->_generateUniqueID();
        $issueInstant = $this->_getTimestamp();

        $request = <<<AUTHNREQUEST
<samlp:AuthnRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="$id"
    Version="2.0"
    IssueInstant="$issueInstant"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    AssertionConsumerServiceURL="{$this->_settings->spReturnUrl}">
    <saml:Issuer>{$this->_settings->spIssuer}</saml:Issuer>
    <samlp:NameIDPolicy
        Format="{$this->_settings->requestedNameIdFormat}"
        AllowCreate="true"></samlp:NameIDPolicy>
    <samlp:RequestedAuthnContext Comparison="exact">
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
AUTHNREQUEST;

        // Encode the request
        $deflatedRequest = gzdeflate($request);
        $base64Request = base64_encode($deflatedRequest);
        $encodedRequest = urlencode($base64Request);

        // Build redirect URL
        $url = $this->_settings->idpSingleSignOnUrl . "?SAMLRequest=" . $encodedRequest;

        // Keep the original GET parameters
        foreach ($this->_get_params as $param => $value) {
            $url .= "&" . $param . "=" . urlencode($value);
        }

        return $url;
    }
29001
public function redirectionLink()
    {
        $childPage = $this->Children()->first();

        if ($childPage) {
            // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of
            // redirector pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in
            // the browser, but this can be handled sufficiently gracefully by the browser.
            if ($childPage instanceof RedirectorPage) {
                return $childPage->regularLink();
            }
            // For all other pages, just return the link of the page.
            return $childPage->Link();
        }
    }
1295657
public static function back()
    {
        $referer = $_SERVER['HTTP_REFERER'];

        if (! empty($referer)) {
            return self::redirect($referer);
        }

        return self::redirect('/');
    }
540074
protected function _refererRedirectUrl($default = null)
    {
        $controller = $this->_controller();

        return $this->_redirectUrl($controller->referer($default, true));
    }
427336
protected function _getUrlToRedirectBackTo()
    {
        $urlToRedirectBackTo = $this->request->getRequestTarget();
        if (!$this->request->is('get')) {
            $urlToRedirectBackTo = $this->request->referer(true);
        }

        return $urlToRedirectBackTo;
    }
690475
protected function redirectToRefererOrRoute(
        string $routeName,
        array $routeParameters = []
    ): RedirectResponse {
        try {
            return $this->redirectToReferer();
        } catch (CannotRedirectToEmptyRefererUrlException $exception) {
            return $this->redirectToRoute($routeName, $routeParameters);
        }
    }
974083
public function redirect() : RedirectResponse {
        if( ! $this->notified) {
            $this->notify();
        }

        $url = $this->url ?: app(UrlGenerator::class)->previous();

        return response()->redirectTo($url);
    }
1245318
protected function _redirect()
    {
        $request = $this->_controller->request;
        return $this->_controller->redirect([
            'prefix'     => $request->getParam('prefix'),
            'plugin'     => $request->getParam('plugin'),
            'controller' => $request->getParam('controller'),
            'action'     => $this->getConfig('action')
        ]);
    }
722045
public function getRedirectUri()
	{
		return null === $this->loginAgentUrl ? $this->callbackUrl : ($this->loginAgentUrl . '?' . http_build_query(array('redirect_uri'=>$this->callbackUrl)));
	}
1114751
protected function checkReferrer()
    {
        if (! isset($_SERVER['HTTP_REFERER'])) {
            throw new ErrorException('Direct image manipulation is not allowed.');
        }

        $referrer = preg_replace('%^https?://%', '', $_SERVER['HTTP_REFERER']);
        if (! preg_match("%^{$_SERVER['SERVER_NAME']}%", $referrer)) {
            throw new ErrorException('Referrer does not match the correct domain.');
        }
    }
234745
protected function createRedirectContainer($orderReference)
    {
        $redirectContainer = new RedirectContainer();

        $sig = $this->getUrlHmacGenerator()->hash($orderReference, $this->getStandardParameter()->getKey());
        $params = '?orderReference=' . $orderReference . '&sig=' . $sig;

        $redirectContainer->setSuccessUrl($this->getStandardParameter()->getRedirectSuccessUrl() . $params);
        $redirectContainer->setBackUrl($this->getStandardParameter()->getRedirectBackUrl() . $params);
        $redirectContainer->setErrorUrl($this->getStandardParameter()->getRedirectErrorUrl() . $params);

        return $redirectContainer;
    }
869812
public function getRedirectReferer()
    {
        $redirect = $this->parameters->get('redirect');
        $referer = $this->request->headers->get('referer');

        if (!is_array($redirect) || empty($redirect['referer'])) {
            return $referer;
        }

        if ($redirect['referer'] === true) {
            return $referer;
        }

        return $redirect['referer'];
    }
735673
public function authCodeRequestDeniedRedirectUri()
    {
        $error = new AccessDeniedException();

        return $this->getRedirectUriGenerator()->make($this->getAuthCodeRequestParam('redirect_uri'), [
                        'error' => $error->errorType,
                        'error_description' => $error->getMessage(),
                ]
        );
    }
64548
public function linkAccount() {
    $sdk = $this->getSdk();

    if ($sdk instanceof RedirectResponse) {
      return $sdk;
    }

    $this->authManager->setSdk($sdk);
    $url = $this->authManager->getAuthenticationUrl('link');

    return new TrustedRedirectResponse($url);
  }