mayBypass($request)) { return $next($request); } $until = Maintenance::until(); return response()->json([ 'message' => Maintenance::message(), 'maintenance' => true, 'locale' => app()->getLocale(), 'since' => Maintenance::startedAt()?->toIso8601String(), 'until' => $until?->toIso8601String(), ], Response::HTTP_SERVICE_UNAVAILABLE, [ 'Retry-After' => (string) Maintenance::retryAfter(), // 503 must never be cached, or the notice would outlive the // maintenance itself. 'Cache-Control' => 'no-store, private', ]); } /** * The team still sees the real site. * * The preview secret already means "I am the frontend acting for someone * trusted", and the frontend's own address is equally trusted — so both * pass straight through and can verify the fix before lifting the flag. */ protected function mayBypass(Request $request): bool { if ($request->attributes->get('preview', false)) { return true; } return in_array($request->ip(), (array) config('site.trusted_ips'), true); } }