CluPilotCloud/app/Http/Middleware
nexxo e2b4cdbac4 feat(site): switch the public website and portal off from the console
While the product is still being built, the marketing site and the customer
portal should not be reachable — but they must stay reachable for us.

- A toggle in the console (site.manage, Owner/Admin) stored in a new
  app_settings table, because this has to be flippable without a deploy.
- Outsiders get a placeholder with 503 + noindex, not 200: a 200 invites search
  engines to index the placeholder as the site's content, which is far harder
  to undo than to prevent.
- Anyone on the management VPN, and any signed-in operator, sees the real site.
  The console, Livewire's endpoint, the Stripe webhook and the health check are
  always reachable — otherwise the switch could only be flipped once.
- robots.txt is generated by the app and follows the switch. It had to stop
  being a static file: nginx short-circuited it and Laravel's stock file said
  'Disallow:' with an empty value, so crawlers were never told anything.
- Settings reads fall back to the default when the table is unavailable. The
  gate reads one on every request, so a deploy running new code before migrate
  would otherwise answer the entire site with a 500.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 23:10:27 +02:00
..
EnsureAdmin.php fix(admin): remove is_admin self-heal — RBAC is the only console boundary (no revocation bypass) 2026-07-25 18:35:14 +02:00
EnsureCustomerActive.php feat(admin): staff RBAC (spatie) + admin settings page 2026-07-25 15:47:42 +02:00
PublicSiteGate.php feat(site): switch the public website and portal off from the console 2026-07-25 23:10:27 +02:00
RestrictAdminHost.php fix(security): match ADMIN_HOSTS case-insensitively; share test helpers 2026-07-25 20:56:26 +02:00