local-web-search/.env.example
User 382cc97e98 Fix MCP transport for reverse-proxy deployment (Invalid Host header + http redirect)
Two bugs surfaced deploying behind Cloudflare+Caddy at a public domain:

1. MCP streamable-HTTP DNS-rebinding protection has empty allowed_hosts by
   default, so a proxied public Host returns 421 'Invalid Host header'. Added
   MCP_ALLOWED_HOSTS (comma-separated; '*' disables) wiring into the FastMCP
   transport_security settings; localhost added automatically.
2. The /mcp -> /mcp/ mount redirect downgraded to http:// because uvicorn
   ignored X-Forwarded-Proto. Run uvicorn with --proxy-headers
   --forwarded-allow-ips='*' so redirects stay https behind the proxy.

Verified locally: valid Host+token initializes (200 SSE), redirect Location is
https, spoofed Host still 421, missing token still 401.

Set MCP_ALLOWED_HOSTS=websearch.neilbantoc.dev on the deployment and redeploy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 11:08:48 -07:00

39 lines
1.1 KiB
Text

# Copy to .env and adjust. All values shown are the defaults used in compose.
# Public port + bind address for the orchestrator (MCP + REST; only exposed
# service). Bind 127.0.0.1 to keep it localhost-only (reach it over a tunnel).
ORCHESTRATOR_PORT=8000
ORCHESTRATOR_BIND=0.0.0.0
# Bearer token required on every request (Authorization: Bearer <key>).
# Leave empty to DISABLE auth — only safe on trusted/LAN networks.
# install.sh generates a strong value automatically.
LWSS_API_KEY=
# Hostnames allowed to reach the MCP transport (DNS-rebinding protection).
# Behind a reverse proxy, set this to your public domain or the MCP endpoint
# returns 421 "Invalid Host header". Comma-separated; "*" disables the check.
# Leave empty for localhost-only.
MCP_ALLOWED_HOSTS=
# Cache TTLs (seconds)
RENDER_CACHE_TTL=3600
SEARCH_CACHE_TTL=300
EXTRACT_CACHE_TTL=3600
# Renderer
RENDER_CONCURRENCY=4
RENDER_TIMEOUT_MS=30000
RENDER_WAIT_POLICY=networkidle
RENDER_RETRIES=1
# Politeness: max renders per domain per window
DOMAIN_RATE_LIMIT=10
DOMAIN_RATE_WINDOW_S=10
# Timeouts
STAGE_TIMEOUT_S=60
SEARCH_TIMEOUT_S=15
# SearXNG
SEARXNG_SECRET=change-me-lwss-internal