Skip to content

Commit

Permalink
Do not cache the logout page
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed Nov 17, 2021
1 parent f6b808a commit 58575c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Middleware/LogoutMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ public function __construct(CookieFactory $cookie, UrlGenerator $url)

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$logoutUri = new Uri($this->url->to('forum')->path('/logout'));
$logoutUri = new Uri($this->url->to('forum')->route('logout'));
$response = $handler->handle($request);
if ($request->getUri()->getPath() === $logoutUri->getPath() && $response instanceof RedirectResponse) {
$response = $response->withHeader('X-LiteSpeed-Cache-Control', 'no-cache');
return $this->withExpiredVaryCookie($response, $request->getAttribute('session'));
}

Expand Down

0 comments on commit 58575c2

Please sign in to comment.