mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-04-28 11:30:00 +00:00
feat: simplify reverse proxy configuration with Next.js rewrites (#213)
Some checks are pending
Development Build / extract-version (push) Waiting to run
Development Build / test-build-regular (push) Blocked by required conditions
Development Build / test-build-single (push) Blocked by required conditions
Development Build / summary (push) Blocked by required conditions
Some checks are pending
Development Build / extract-version (push) Waiting to run
Development Build / test-build-regular (push) Blocked by required conditions
Development Build / test-build-single (push) Blocked by required conditions
Development Build / summary (push) Blocked by required conditions
* feat: simplify reverse proxy configuration with Next.js rewrites Add Next.js API rewrites to proxy /api/* requests internally from port 8502 to the FastAPI backend on port 5055. This eliminates the need for complex reverse proxy configurations with multiple upstreams and location blocks. Changes: - Add rewrites to next.config.ts proxying /api/* to INTERNAL_API_URL - Introduce INTERNAL_API_URL env var (defaults to http://localhost:5055) - Update supervisord configs to pass INTERNAL_API_URL to Next.js - Document INTERNAL_API_URL in .env.example with usage examples - Add simplified reverse proxy examples for nginx, Traefik, Caddy, Coolify - Update README architecture diagram to show internal proxying - Add explanatory comments to _config route handler Benefits: - Reduces reverse proxy config from 12 lines to 3 (75% reduction) - Single-port deployment (8502 only) for 95% of use cases - Zero breaking changes - backward compatible with existing setups - Zero performance overhead (validated through testing) - Preserves proxy headers (X-Forwarded-*) for rate limiting/SSL Resolves: #179 Related: OSS-321 * fix: rename _config to config to fix production routing CRITICAL BUG FIX: The /_config endpoint has never worked in production builds because Next.js treats folders starting with underscore as "private folders" and excludes them from routing entirely. This endpoint is critical for: - Providing API_URL to the browser at runtime - Enabling zero-config deployments with auto-detection - Supporting reverse proxy scenarios where API URL differs from frontend URL Changes: - Rename frontend/src/app/_config/ → frontend/src/app/config/ - Update client code references (/_config → /config) - Update documentation with correct endpoint path - Bump version to 1.1.0 (minor version for new rewrites feature + bug fix) Impact: - Runtime configuration now works in production builds - /config returns {"apiUrl":"http://localhost:5055"} correctly - Auto-detection for reverse proxy deployments now functional Related: #179, OSS-321 * fix: resolve React hook exhaustive-deps warning in AddExistingSourceDialog Wrap performSearch function in useCallback to properly memoize it and satisfy React Hook exhaustive-deps rule. This prevents unnecessary re-renders and ensures the useEffect dependency array is correctly specified. Changes: - Import useCallback from React - Wrap performSearch with useCallback([debouncedSearchQuery, allSources]) - Add performSearch to useEffect dependency array * final fixes
This commit is contained in:
parent
d680a0affc
commit
9bdfd99f1b
14 changed files with 371 additions and 193 deletions
21
.env.example
21
.env.example
|
|
@ -19,6 +19,27 @@
|
|||
# Only set this if you need to override the auto-detection (e.g., reverse proxy scenarios).
|
||||
API_URL=http://localhost:5055
|
||||
|
||||
# INTERNAL API URL (Server-Side)
|
||||
# URL where Next.js server-side should proxy API requests (via rewrites)
|
||||
# This is DIFFERENT from API_URL which is used by the browser client
|
||||
#
|
||||
# INTERNAL_API_URL is used by Next.js rewrites to forward /api/* requests to the FastAPI backend
|
||||
# API_URL is used by the browser to know where to make API calls
|
||||
#
|
||||
# Default: http://localhost:5055 (single-container deployment - both services on same host)
|
||||
# Override for multi-container: INTERNAL_API_URL=http://api-service:5055
|
||||
#
|
||||
# Common scenarios:
|
||||
# - Single container (default): Don't set - defaults to http://localhost:5055
|
||||
# - Multi-container Docker Compose: INTERNAL_API_URL=http://api:5055 (use service name)
|
||||
# - Kubernetes/advanced networking: INTERNAL_API_URL=http://api-service.namespace.svc.cluster.local:5055
|
||||
#
|
||||
# Why two variables?
|
||||
# - API_URL: External/public URL that browsers use (can be https://your-domain.com)
|
||||
# - INTERNAL_API_URL: Internal container networking URL (usually http://localhost:5055 or service name)
|
||||
#
|
||||
# INTERNAL_API_URL=http://localhost:5055
|
||||
|
||||
# API CLIENT TIMEOUT (in seconds)
|
||||
# Controls how long the frontend/Streamlit UI waits for API responses
|
||||
# Increase this if you're using slow AI providers or hardware (Ollama on CPU, remote LM Studio, etc.)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue