Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Fixing previous url #27935

merged 1 commit into from Mar 19, 2019


None yet
3 participants
Copy link

veencel commented Mar 19, 2019

Currently, the previous url is set too early in the StartSession middleware.
When the referrer header is missing, the back() call always redirects to the current URL creating a redirect loop.

I think this commit introduced this bug, setting the url after calling the $next callback solves the issue.

Vencel Kátai

This comment has been minimized.

Copy link

driesvints commented Mar 19, 2019

I believe this is indeed the culprit. I was just investigating this myself and think the reversal of the sequence in which these calls were made indeed broke it. But this definitely needs a test or otherwise this will break again.

#27894 (comment)

@@ -53,12 +53,12 @@ public function handle($request, Closure $next)
$this->storeCurrentUrl($request, $session);
$response = $next($request), $session

This comment has been minimized.

Copy link

driesvints Mar 19, 2019


Instead of writing this like so in which the next call gets lost in the other call this might be a more obvious approach:

        $response = $next($request);

        $this->storeCurrentUrl($request, $session);
        $this->addCookieToResponse($response, $session);

@driesvints driesvints changed the title Fixing previous url [5.8] Fixing previous url Mar 19, 2019

@taylorotwell taylorotwell merged commit be3c8ba into laravel:5.8 Mar 19, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
continuous-integration/travis-ci/pr The Travis CI build passed

@veencel veencel deleted the veencel:previous-url-fix branch Mar 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.