alepha@docs:~/framework/docs/reference/providers$
cat ServerSiteGateProvider.md | pretty2 min read
Last commit: Nov 29, 2026 UTC
#ServerSiteGateProvider
#Import
typescript
1import { ServerSiteGateProvider } from "alepha/server";
#Overview
The site gate: the whole site behind HTTP basic auth, turned on by the environment alone.
SITE_GATE_USERNAMEandSITE_GATE_PASSWORDboth set: on.- Neither: off, and this provider does nothing.
- Only one: the app refuses to start, since a gate half configured is a gate someone believes is on.
No primitive to declare: the app's code is the same in every environment, and a hosted copy (a staging, a demo) is protected by setting two variables and redeploying, with no rebuild.
#What it does
- Registers one check on every route (
/*), SSR pages and$servestatic files included. - Accepts
Authorization: Basic, orx-site-gate: <username>:<password>for a script whoseAuthorizationcarries a bearer token. Either is removed from the request once checked, so the app's own authentication never sees it. - Once passed, sets a gate cookie (
HttpOnly,Secure,SameSite=Lax, signed with a key derived fromSITE_GATE_PASSWORDandAPP_SECRET), so a browser is not asked again and a password change voids every cookie.passsets it from a module that admitted a visitor another way. - Leaves open the prefixes modules declare with
allow: the health probes/health,/healthz,/readyzand/livezby default, since a supervisor probing a protected copy has no password./versionstays gated.
#Limit on Cloudflare Workers
A Worker serves the files of dist/public (bundles, images and prerendered
pages) from Cloudflare's asset layer before the worker runs, so the gate
covers what the worker serves (server-rendered pages, API, $serve routes)
and those files stay public.