getPath()); try { // 세션 읽기 시도 $loggedIn = $session->get('logged_in'); // 로그인 체크 if (!$loggedIn) { // 로그인 안 되어 있으면 로그인 페이지로 return redirect()->to('/login'); } } catch (\Exception $e) { // 세션 오류 (Redis 다운 등) - 모든 예외 catch log_message('error', '[SESSION ERROR in AuthCheck] ' . $e->getMessage()); // AJAX 요청인 경우 JSON 응답 if ($request->isAJAX()) { return service('response') ->setStatusCode(503) ->setJSON([ 'code' => '8', 'msg' => '세션 서비스 오류입니다. 페이지를 새로고침 해주세요. (Redis)' ]); } // 일반 요청인 경우 로그인 페이지로 리다이렉트 (에러 메시지 포함) return redirect()->to('/login')->with('error', '세션 서비스 오류입니다. 시스템 관리자에게 문의해주세요.'); } } public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { // After logic not required } } ?>