Password-protect a distribution
Password protection applies immediately to the live distribution. It does not create or promote a deployment, and it does not change the files visitors see after they sign in.
Open Security in the web app, choose the distribution, enter the password, and choose Require a password. Leave the password blank later to keep the current one and change only the session length or the login page. Make public removes the gate. That is a weaker setting, so a sign-in without permission to change access is refused and the distribution stays protected.
You can ask an agent, use the CLI, or call the API to do the same thing.
Require the password "correct horse battery staple" on the acme-marketing distribution.edge api PATCH /v1/distributions/d3f7a1c4-90b2-4e6a-8f15-6c2b7e0a9d38 --input - <<'EOF'
{
"access": {
"mode": "password",
"password": "correct horse battery staple"
}
}
EOFcurl -s -X PATCH \
https://api.edge.deca-dev.com/v1/distributions/d3f7a1c4-90b2-4e6a-8f15-6c2b7e0a9d38 \
-H "Authorization: Bearer $EDGE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"access": {
"mode": "password",
"password": "correct horse battery staple"
}
}'The agent runs edge_distribution_update. mode: "password" is stored as login with the password method. Edge stores an Argon2 hash, not the plaintext. A later read returns the mode, the methods, and the session length, and never the hash.
Visitors without a valid access cookie are redirected to /_auth/login. The page is in English or Japanese. A successful submission returns them to / and sets an edge_access cookie. The cookie is bound to that distribution. The session lasts 8 hours unless you set session_ttl from 1h to 24h.
Sending { "access": { "mode": "password" } } keeps the existing hash. To make the distribution public again, send { "access": { "mode": "public" } }. Existing deployment content is unchanged.
Next: Customize the login page or Sign visitors out.