Files
Ariel AI c0ff87ea10 feat(cp): add optional access-key login for Control Plane (#1530)
Add HINDSIGHT_CP_ACCESS_KEY env var to enable a lightweight
shared-secret authentication gate for the Control Plane UI.

Features:
- Login page at /login with access key input form
- /api/auth/login endpoint validates key and sets HttpOnly session cookie
- /api/auth/logout endpoint clears session cookie
- Middleware protects all routes except /login, /api/auth/*, /api/health,
  /api/version, static assets, and _next
- returnTo query param preserves redirect after login
- Constant-time comparison for access key to prevent timing attacks
- Logout button in sidebar (when a bank is selected) and dashboard header
- Updated .env.example and docker-compose docs

Security:
- HttpOnly, SameSite=lax, Secure (production only) cookie
- 24-hour session lifetime
- Constant-time string comparison to prevent timing attacks
2026-05-08 09:37:30 +02:00
..

Nginx Reverse Proxy with Custom Base Path

Deploy Hindsight API under /hindsight (or any custom path) using Nginx reverse proxy.

Quick Start (Published Image - API Only)

docker-compose up

Full Stack with Custom Base Path (Requires Build)

Important: You cannot rebuild from the published image with build args. You must build from source.

Build from Source with Custom Base Path

  1. Clone the repository (if you haven't):
git clone https://github.com/vectorize-io/hindsight.git
cd hindsight
  1. Build with base path:
docker build \
  --build-arg NEXT_PUBLIC_BASE_PATH=/hindsight \
  -f docker/standalone/Dockerfile \
  -t hindsight:custom \
  .
  1. Update docker-compose.yml to use your built image:
services:
  hindsight:
    image: hindsight:custom  # ← Change this
    environment:
      HINDSIGHT_API_BASE_PATH: /hindsight
      NEXT_PUBLIC_BASE_PATH: /hindsight
  1. Update nginx.conf to handle Control Plane routes (see below)

  2. Run:

docker-compose up

Required nginx.conf for Full Stack

Replace the current nginx.conf with this to proxy both API and Control Plane:

events { worker_connections 1024; }

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    upstream hindsight_api { server hindsight:8888; }
    upstream hindsight_cp { server hindsight:9999; }

    server {
        listen 80;

        # API
        location ~ ^/hindsight/(docs|openapi\.json|health|metrics|v1|mcp) {
            proxy_pass http://hindsight_api;
            proxy_set_header Host $http_host;
        }

        # Control Plane static files
        location ~ ^/hindsight/_next/ {
            proxy_pass http://hindsight_cp;
            proxy_set_header Host $http_host;
        }

        # Control Plane UI
        location /hindsight {
            proxy_pass http://hindsight_cp;
            proxy_set_header Host $http_host;
        }

        location = / { return 301 /hindsight; }
    }
}

Why Build is Required

Next.js requires basePath at build time. The published image was built without a custom base path, so you must rebuild from source with the NEXT_PUBLIC_BASE_PATH build arg to deploy the Control Plane under a subpath.

The API works without rebuild because HINDSIGHT_API_BASE_PATH is a runtime environment variable.