* feat: add reverse proxy support * improve * improve * improve * improve * improve * fix: update integration test to use modern 'docker compose' command - Replace 'docker-compose' with 'docker compose' (Docker Compose v2+) - Add fallback to legacy docker-compose command for compatibility - Fixes test failures on systems using Docker Compose plugin * ci: trigger test rerun * fix: make docker-compose detection more robust for CI - Add get_docker_compose_command() to detect available command - Use shutil.which() to check command availability - Dynamically use correct command (docker compose vs docker-compose) - Should work in both modern and legacy Docker environments * fix: docker-compose networking in base path integration test Fix connection refused error in test_reverse_proxy_simple_config by handling host vs bridge networking modes correctly: - Linux (host mode): nginx listens on 18080 directly, no port mapping - Mac/Windows (bridge mode): nginx listens on 80, mapped to 18080 With host networking, port mappings in docker-compose don't work since the container binds directly to the host's network namespace. |
||
|---|---|---|
| .. | ||
| docker-compose.yml | ||
| nginx.conf | ||
| README.md | ||
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
- API: http://localhost:8080/hindsight/docs
- Control Plane: http://localhost:9999 (direct access, not proxied)
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
- Clone the repository (if you haven't):
git clone https://github.com/vectorize-io/hindsight.git
cd hindsight
- Build with base path:
docker build \
--build-arg NEXT_PUBLIC_BASE_PATH=/hindsight \
-f docker/standalone/Dockerfile \
-t hindsight:custom \
.
- 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
-
Update nginx.conf to handle Control Plane routes (see below)
-
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.