Open teepluss opened 8 years ago
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); }
Probably somewhat cleaner solution could be to use POST for logout – POST requests should not be cached.
See Symfony's HttpCache documentation
Thank you, That's works!
I cannot use auth()->logout() after at the httpcache middleware, It still logged in, so I have to modify the kernel like this.