Configure

Security

HTTPS, proxies, saved secrets and rate limits for an install other people can reach.

The defaults are safe for a local install. Change these before you put Kanesh on the internet.

HTTPS and headers

VariableDefaultWhat it does
COOKIE_SECUREfalseSet true when Kanesh is served over HTTPS, including behind a TLS proxy. Cookies are then sent only over HTTPS.
HSTS_ENABLEDsame as COOKIE_SECURETells browsers to always use HTTPS for this host (180 days).
CONTENT_SECURITY_POLICYstrict, same-origin onlyReplaces the Content-Security-Policy for Studio pages. API responses have none. Only change it if you embed Studio resources from elsewhere.
TRUSTED_PROXIESunsetProxies allowed to pass the real client IP in X-Forwarded-For, as IPs or CIDRs.

Note: Behind a reverse proxy, set TRUSTED_PROXIES to its network. Otherwise every visitor looks like the proxy and shares one rate limit.

Saved secrets

Some settings saved in Studio are secrets, such as the SMTP password. Kanesh encrypts them with this key.

VariableDefaultWhat it does
SETTINGS_ENCRYPTION_KEYunsetEncryption key, at least 16 characters. Without it, Studio cannot save secrets.
SECRETunsetFallback key, used only when SETTINGS_ENCRYPTION_KEY is unset.

Back the key up. If it changes, you have to enter every saved secret again. Never commit a real value.

Rate limit

Each client gets a request budget on /api/ that refills over time.

VariableDefaultWhat it does
RATE_LIMIT_ENABLEDtruefalse turns the limit off. Keep it on for public installs.
RATE_LIMIT_POINTS600Requests allowed per client in one window.
RATE_LIMIT_DURATION1mLength of the window.
RATE_LIMIT_AUTH_POINTS20Stricter budget for login and the installation claim.
RATE_LIMIT_AUTH_DURATION1mWindow for that stricter budget.

When the budget runs out, the API returns 429 with a Retry-After header.

Checklist before going public

  • DEMO_MODE is false or unset.
  • HTTPS works and COOKIE_SECURE=true.
  • TRUSTED_PROXIES matches your proxy.
  • SETTINGS_ENCRYPTION_KEY is set and backed up.

Next steps

Buy me a coffee