diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 9b01565..5584226 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -105,11 +105,12 @@ public function boot(IBootContext $context): void // redirecting to the logout url. $session->set('clearingExecutionContexts', '1'); $session->close(); - header('Clear-Site-Data: "cache", "storage"'); + if (!$this->isApiRequest()) { + header('Clear-Site-Data: "cache", "storage"'); + header('Location: '.$logoutUrl); - header('Location: '.$logoutUrl); - - exit; + exit; + } }); } @@ -157,4 +158,9 @@ public function boot(IBootContext $context): void } } } + + public function isApiRequest() + { + return isset($_SERVER['HTTP_ACCEPT']) && false !== strpos($_SERVER['HTTP_ACCEPT'], 'application/json'); + } }