Web Sign-In
The public index shows your store the way a stranger sees it. Sometimes you want to see it the way you see it: private reports, unlisted drafts, the hidden folder you shared last week. Web sign-in lets you open the index with an API key and browse everything that key can see — read-only, in any browser, with no new kind of account to manage.
Off by defaultWeb sign-in arrived in v0.3 and stays switched off until you set VELA_WEB_AUTH=on. While it is off, no route, cookie, header or page changes — upgrading is a no-op.
How it works
A web session is a thin wrapper around an API key, not a new credential. You paste a key into the sign-in form once; Vela checks it and hands your browser a cookie holding a random session ID. The key itself is never stored in the browser.
- Any key can sign in — ro, rw or admin. The session is always read-only: there is no write route for it, whatever the key may do through the API.
- The session follows its key. The key is read again on every request, so revoking it signs the browser out on the very next click, and a changed prefix applies immediately.
- The prefix still applies. A key restricted to
clients/acme/sees that subtree in full and everything else exactly as an anonymous visitor would.
Turning it on
-
Enable it in the env file
# Optional read-only browser sign-in with an API key: on or off. VELA_WEB_AUTH=on # Sliding idle timeout and absolute lifetime of a web session. VELA_WEB_SESSION_IDLE=7d VELA_WEB_SESSION_MAX=30dSign-in needs an
httpsVELA_PUBLIC_URL, because the session cookie isSecureand browsers drop it over plain HTTP.veladrefuses to start otherwise. -
Check your proxy
Direct delivery and the Caddy example need nothing new. With nginx accel, add the two new
add_headerlines to both internal locations first — see nginx. Behind a CDN, add a cache bypass rule for the session cookie — see Caching and proxies below. -
Recreate the container
docker stop vela && docker rm vela VELA_IMAGE=xchunk/vela:0.9.0 ./examples/docker/run-fs.sh docker logs vela | grep 'web sign-in'The startup log confirms it with
web sign-in enabledand the configured session lifetimes. -
Sign in
Every anonymous index page now has a small sign in link in its footer. It opens
/_vela/login: one password field, one button. Paste an API key, and you land back on the page you came from.
Give the browser its own keyCreate a dedicated read-only key for browsing, so you can revoke it without touching the keys your CLI and CI use: velad key create --name browser --scope ro. Add --prefix if the browser only needs one corner of the store.
Trying it locally
On http://127.0.0.1 there is no TLS, so the development server needs one extra switch that sends the cookie without Secure:
VELA_WEB_AUTH=on VELA_WEB_INSECURE_COOKIE=on make dev
Open http://127.0.0.1:8080/_vela/login and sign in with the printed admin key. velad logs a warning while the insecure cookie is on — never use it in production.
What a signed-in visitor sees
The visible tree is the anonymous view plus the full view of the key's prefix. Prefixes match on whole path segments, so a key for test/ never reveals test2/.
| Location | Signed-in behavior |
|---|---|
| Inside the key's prefix | Every live object is listed and served, whatever its visibility. Directory policies — hidden entrances, disabled indexes — are ignored. |
| Ancestors of the prefix | The anonymous listing, plus one entrance: the child on the way to the prefix, even if it is hidden or its parent's index is disabled. No other hidden sibling appears. |
| Everything else | Exactly anonymous, status codes included. A path the session cannot see is a 404, never a 403. |
A key without a prefix sees everything, including hidden directories and a disabled root index. Expired and trashed objects stay invisible either way — restore them with vela trash restore.
Visibility indicators
Signed-in pages mark everything an anonymous visitor could not find with a small icon after the name. Hover or focus it to read what it means:
| Flag | On | Tooltip |
|---|---|---|
| private | Files | Private: needs a key or signed link |
| unlisted | Files | Unlisted: anyone with the URL can open it |
hidden | Directories | Hidden: not shown to anonymous visitors in the parent listing |
no-index | Directories | Index disabled for anonymous visitors |
symlink | Files | Symlink: serves the content of another file |
Public files carry no indicator — what you see unmarked is what everyone sees. The footer shows who you are (signed in: full access or the key's prefix) next to a sign out button. ?format=json on an index includes the same flags and a session object for signed-in requests; anonymous JSON is unchanged.
Sessions
Idle timeoutdefault 7dVELA_WEB_SESSION_IDLE, sliding. Activity is recorded at most once an hour, so a session may end up to that much before the configured timeout. At least one minute.
Absolute lifetimedefault 30dVELA_WEB_SESSION_MAX. After this, sign in again no matter how active the session was. Not shorter than the idle timeout.
Cookie__Host-vela_session with Secure, HttpOnly, SameSite=Lax, Path=/ and no Domain. Lax keeps links opened from chats and notes signed in; every state change is a POST.
StorageOnly the SHA-256 of the session ID lives in the database, next to the key ID and timestamps. The janitor task web_sessions purges expired rows.
Signing in again replaces the browser's previous session. Unknown, idle, expired and revoked-key sessions all simply make the request anonymous.
Signing out everyone
The footer's sign out ends the current session. To end every browser session at once — say, a cookie may have leaked — run on the server:
$ docker exec vela velad session revoke-all
Revoked 3 web session(s).
API keys are unaffected; their owners can sign in again. To lock out a single key everywhere — API, CLI and browser — revoke the key instead.
How the form is protected
- The key travels only in the form body of a
POST(at most 4 KiB). A key in a URL such as?key=is ignored, never echoed and never logged. - Same-origin only. Sign-in and sign-out accept
Sec-Fetch-Site: same-origin, or anOriginequal toVELA_PUBLIC_URL; anything else is403. - Five failed attempts per minute per client IP, then
429withRetry-After. This budget is separate from the API's. Client IPs come from forwarding headers only for trusted proxies. - One generic message, “Invalid API key.”, in the same time for unknown and wrong keys.
- Safe redirects.
?next=must be a root-relative path; anything else returns you to/.
Caching and proxies
With sign-in on, the same URL can answer differently for you and for a stranger, so Vela marks its responses accordingly:
- Index, direct-URL and themed error responses carry
Vary: Cookie. - The sign-in page and everything produced for a session — pages, JSON, files, redirects, 404s — carry
Cache-Control: private, no-store. - Anonymous responses keep their usual caching.
CDNs ignore Vary: CookieCloudflare and similar CDNs cache by file extension and ignore Vary: Cookie. Add a cache bypass rule for requests carrying the __Host-vela_session cookie, or signed-in responses could be served to anonymous visitors and the other way round. Never add proxy_cache in front of Vela.
The upload sandbox
Without sign-in, Vela's origin holds no cookies, so an uploaded HTML page has nothing to steal. With sign-in it does — an uploaded page could otherwise use your session to read and leak private files. So while VELA_WEB_AUTH is on, every upload except raster images, audio, video, PDF and plain text is served with:
Content-Security-Policy: sandbox allow-scripts allow-forms allow-popups allow-modals allow-downloads
HTML, SVG and any XML still render and their scripts still run — just in an opaque origin without cookies, storage or same-origin reads. This applies in every delivery mode. HTML pages and sandboxed uploads also carry Referrer-Policy: same-origin; private files and signed links keep no-referrer. Details in Security.
Checking a deployment
- Sign in at
/_vela/login, open a private file and checkCache-Control: private, no-store. - Open the same URL in a private window: it must return 404.
- Upload a small HTML file and check its response carries
Content-Security-Policy: sandbox ….
vela new tmp/check.html --content '<p>hi</p>' --public
curl -sI https://store.example.com/tmp/check.html | grep -i content-security-policy
vela rm tmp/check.html
Custom themes
Themes without the new calls keep working: they simply show no indicators and no sign-in link. To opt in, render {{range .Flags}}{{flagIcon .}}{{end}} after each name and add the sign-in state to the footer. The theming guide has the snippets and the optional login.html template.