Production checklist
What to set and check before an app takes real traffic. Each item says what Hamur does without your help and links the page that has the key. The self-hosting guide covers the image, the proxy and the stop.
Secrets and sessions
HAMUR_KEYis set in the environment of every instance, 32 bytes, and kept out of the image and the repository. A built server with a malformed key does not start, and one with no key throwsHAMUR_KEY is not set. Keep the old key after a rotation:HAMUR_KEY=<new>,<old>. See The app key.- Every variable the app reads is declared in
app/env.ts, and the config reads a secret only throughenv("NAME")(a storageurlorencrypt,tasks.http.token, a route rule'sbasicAuth.password, a module's credentials), never as a literal. AHAMUR_<KEY>variable named after aruntimeConfigkey changes nothing; the variables Hamur reads itself are listed. A misspelt name or a private entry underruntimeConfig.publicfails the build, and a missing private value stops the server at start (Environment). - While you rotate a session password,
useSessiongets the new one first and the old one after it (Rotating the password). - Form posts carry a
csrf()token bound to the session (CSRF).
Headers, origin and CSP
- The three default headers are on (
nosniff,strict-origin-when-cross-origin,SAMEORIGIN). Addhstsonce every subdomain serves https (Security defaults, Header keys). - The cross-origin form check is on (
server.originCheck, on by default); list an identity provider's origin inoriginCheck.allowinstead of turning it off (Security defaults). server.cspis set. It is off by default;mode: "auto"writes a nonce or hashes for the scripts Hamur and your UI library inline (Content Security Policy). Turn oncsp.reportto see violations (Violation reports).server.trustProxyis on behind a proxy, withserver.requestIPfor the client address, orapp.originpins the public origin (Behind a proxy).
Build
build.sourcemapis unset or"none"unless you mean to publish the client maps; a production build writes none by default (hamurreference).server.compressis on (the default) forbunandnode, or the proxy compresses and you turned it off (Compression).- Pages that can be built ahead are prerendered (Prerender).
- The preset is named in the config or
HAMUR_PRESET; the build log says which one it built (Deploy).
Caches
- A cached answer is the anonymous answer: the handler runs on a cache fork without the cookie or
authorization, so a page that depends on the user needsvariesor no cache (Route rules, Opting a request out). - With more than one instance,
cacheis a shared driver (Running several instances). - A handler's answer with a cookie,
privateorno-storeis not stored; check a page that sets a cookie before you put acacherule on it (Checking and shaping entries).
Observability
server.healthis on and the proxy or orchestrator probes it (Health endpoint).- Logs go to a collector or to the host's log driver as JSON lines, the build's default;
server.logRedacthides fields you must not keep (Logging). server.requestLog,server.tracingandserver.metricsare off in a build until you turn them on; a Prometheus scrape needsHAMUR_METRICS_TOKENorprometheus.token, andtoken: falsemakes the endpoint public (Prometheus) (What is on by default, Metrics).- Errors are reported with the
errorhook orserver.clientReports(Reporting errors, Client reports).
Errors
- An error that is not a
createErrorshows only its status text in production, anddatais dropped; throwcreateErrorfor what the visitor should read (Where errors come from). - An error page of your own is in place (The error page, Changing the error answer).
Run
- The image runs as built, with
HEALTHCHECKand a stop grace period of 30 seconds (Stopping). hamur preview --checkpasses on the build before you ship it (hamur preview --check).