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

Cannot logout #25

Open
teepluss opened this issue Mar 4, 2016 · 2 comments
Open

Cannot logout #25

teepluss opened this issue Mar 4, 2016 · 2 comments

Comments

@teepluss
Copy link

teepluss commented Mar 4, 2016

I cannot use auth()->logout() after at the httpcache middleware, It still logged in, so I have to modify the kernel like this.

    public function handle($request)
    {
        $ignores = [
            "login",
            "logout",
            "auth(.+)",
            "admin(.+)",
            "register",
        ];
        $pattern = implode('|', $ignores);

        // Ignore middleware from some routes.
        if (! preg_match('~'.$pattern.'~', $request->path())) {
            $this->prependMiddleware('Barryvdh\HttpCache\Middleware\ParseEsi');
            $this->prependMiddleware('Barryvdh\HttpCache\Middleware\CacheRequests');
        }

        return parent::handle($request);
    }
@webkonstantin
Copy link

Probably somewhat cleaner solution could be to use POST for logout – POST requests should not be cached.

See Symfony's HttpCache documentation

@teepluss
Copy link
Author

Thank you, That's works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants