Skip to content

Configuration & Reverse Proxy

CubyCrate is configured primarily through environment variables passed to the container at launch.

Variable Default Purpose
DATA_DIR_PATH /app/data Root directory for application state: database, keys, temp uploads, and local storage.
PORT 8383 Internal HTTP listening port for the web server.
TRUST_PROXY false Must be set to true when running behind a reverse proxy (Nginx, Caddy, Cloudflare, Traefik).
COOKIE_SECURE false Set to true in production when serving over HTTPS. Prevents session cookies from transmitting over plaintext HTTP.
ALLOWED_ORIGINS "" Comma-separated list of permitted origins for CORS requests, e.g., https://drive.example.com.

When deploying behind a reverse proxy with HTTPS, configure your compose environment as follows:

environment:
- DATA_DIR_PATH=/app/data
- PORT=8383
- TRUST_PROXY=true
- COOKIE_SECURE=true
- ALLOWED_ORIGINS=https://drive.example.com

Running CubyCrate behind a reverse proxy is recommended for TLS/SSL certificates, domain routing, and handling large uploads.

Two critical requirements apply to all proxies:

  1. Unbuffered Server-Sent Events (SSE): CubyCrate uses /api/v1/events for real-time file updates. Proxies must disable buffering on this route.
  2. Generous request body limit: Set client body limits to at least 10 GB so multi-gigabyte uploads are not prematurely severed by the proxy.

Add the following site block to your Caddyfile:

drive.example.com {
# Maximum upload size limit (10 GB)
request_body {
max_size 10GB
}
# Disable response buffering for Server-Sent Events
@sse {
path /api/v1/events
}
reverse_proxy @sse http://127.0.0.1:8383 {
flush_interval -1
}
# Proxy all other traffic
reverse_proxy http://127.0.0.1:8383
}

CubyCrate provides two built-in health probes:

  • GET /health: Liveness probe. Returns HTTP 200 OK as long as the HTTP listener is operational.
  • GET /api/health: Readiness probe. Evaluates SQLite database connectivity and verifies that configured storage nodes are mounted and responsive.

Example health check query:

Terminal window
curl -i http://127.0.0.1:8383/api/health