Access gate
The access gate keeps a project’s environments private. A visitor signs in with an email link or a passkey before the site opens. Only the people on the project’s allow-list can sign in. The gate covers every hostname of a gated environment: its Pushleft hostname, its role hostnames and its custom domains.
Built 2026-11-27. It replaces Cloudflare Access on environment hostnames (Replace Cloudflare Access).
Turn it on
-
Add the people who may sign in. An entry is one email address, or a whole domain written as
*@domain:pl access add '*@example.com' [email protected]Quote a domain entry, or the shell expands the
*. A domain entry covers that domain only:*@example.comlets in[email protected]and refuses[email protected]. -
Gate the environments:
pl access enable # every preview environment pl access enable --all # production too -
Check that the live routes switched:
pl access listPushleft republishes the live routes of the project within a minute. While it does,
pl access listshows how many routes still switch. You need no new deployment.
Run the commands in a checkout with a .pl.yaml, or name the project with --project <slug>. Changing the gate or the list needs the Admin or Owner role.
In the console, open Settings with the project selected in the top bar. The Access gate panel sets the same things.
| Command | Result |
|---|---|
pl access list | Shows which environments are gated and the allow-list. |
pl access add <entry>... | Adds email addresses or *@domain entries. |
pl access remove <entry>... | Removes entries. |
pl access enable [--all] | Gates the previews, or with --all every environment. |
pl access disable | Opens every environment again. |
The visitor’s sign-in
- The visitor opens a page of a gated environment. The sign-in page shows the project’s icon and name (project icon).
- The visitor enters an email address. If the address is on the list, Pushleft mails a sign-in link. Every address gets the same page, so a visitor cannot find out who is on the list.
- The link opens a page with a Continue button. Continue signs the visitor in and goes back to the page they asked for. The link works once, for 15 minutes. Opening the link does not use it up, so a mail scanner that follows the link does no harm.
- On the same page the visitor can add a passkey, or remove one. Next time, Use a passkey on the sign-in page signs them in without a mail.
A passkey works on the hostname where the visitor made it. A preview hostname changes with its branch, so passkeys suit a stable hostname, such as a custom domain.
A sign-in lasts 30 days on that hostname. When you remove an entry, its people lose access within one hour.
Your application gets the visitor’s verified address in the X-Pushleft-Gate-Email request header. The ingress replaces any value a client sends.
The sign-in page
The page uses the project’s icon from Settings > Project icon, and the project’s name. Without an icon it shows the first letter of the name. The page uses no Pushleft logo.
All gate pages are on the path /_pushleft/gate/ of the gated hostname. Requests to that path never reach your application.
Security design
- The check runs on the node. For a gated route, the node’s ingress (Caddy) sends each request to the Pushleft agent on the same node for a check first. The agent checks the visitor’s access cookie on the node. No request goes to the control plane for the check.
- The access cookie (
__Host-pl_gate) is a token signed by the control plane with an Ed25519 key. It names the hostname, the email address and an expiry one hour ahead. The agent checks the signature with the public key in the route. A token for one hostname does not open another one. The cookie is host-only,Secure,HttpOnlyandSameSite=Lax. - The session cookie (
pl_gate_session) holds a random token for the path/_pushleft/gateonly. The control plane stores only its SHA-256. When the access cookie runs out, the browser goes to/_pushleft/gate/refresh. With a valid session and an address on the list, the visitor gets a new access cookie. Then the browser opens the page again. A page load does this without a visible step. A request that is not a page load (POST, orGETfrom a script without redirects) gets401after the access cookie runs out. - Sign-in links are random 256-bit tokens. The control plane stores only their SHA-256. A link works once, for 15 minutes, on the hostname it was sent for.
- Limits. Sign-in requests are rate limited per address and per email.
- Fails closed. When the agent’s check does not answer, the ingress answers
502. A control plane without a gate key does not publish a gated environment. - App admin. When the manifest has an
adminblock, the control plane still reaches that path from its own addresses. Other callers on that path must sign in. - Changes to the gate and the list are in the audit log as
access_gate_changed.
Replace Cloudflare Access
Pushleft does not create Cloudflare Access applications. Some environment hostnames use Cloudflare Access. Remove it after the Pushleft gate is on. Then the environment is never open:
-
Turn on the gate for the project, as in Turn it on.
-
Wait until
pl access listshows no routes that still switch. -
Open the environment in a private browser window. Pass Cloudflare Access, then check that the Pushleft sign-in page shows.
-
In the Cloudflare dashboard, open Zero Trust > Access > Applications. Delete the application for the environment’s hostnames, or remove those hostnames from it. With the API, a token with the Access: Apps and Policies Edit permission does the same:
curl -X DELETE -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ https://api.cloudflare.com/client/v4/accounts/<account id>/access/apps/<application id> -
Open the environment again in a private window. Only the Pushleft sign-in page shows.
Do one environment’s hostnames at a time. An application that covers a wildcard (*.example.com) covers every environment on that domain: remove it only when every one of them is gated.
Set it up on a control plane
The gate needs two settings in the API’s environment file. Without them, the gate cannot be turned on.
| Variable | Value |
|---|---|
PUSHLEFT_GATE_SIGNING_KEY_FILE | An Ed25519 private key in PKCS#8 PEM, readable by the API’s user only. Make it with openssl genpkey -algorithm ed25519 -out gate-signing.pem, then chmod 0400. |
PUSHLEFT_GATE_URL | The API’s public origin, for example https://api.pushleft.dev. Every gated hostname sends /_pushleft/gate/ there. |
At start the API writes the public key and the URL to the database. The scheduler puts them in every gated route. A new key republishes every gated route; visitors with a valid session get a new access cookie without a new sign-in.
Each node’s agent checks tokens on 127.0.0.1:9467. Set PUSHLEFT_GATE_LISTEN to use another loopback address. Nodes must reach the API’s public origin on port 443.
Release order: agents first, then the control plane. An older agent refuses a gated route, so a gated environment does not go live on it.