Skip to content

Conversation

@skylenet
Copy link
Member

Summary

  • Makes the reverse proxy behavior optional in the web container
  • By default, the browser now connects directly to the API (no reverse proxy)
  • Set ENABLE_PROXY=true to use nginx as a reverse proxy (previous behavior)

Changes

  • Add ENABLE_PROXY environment variable (default: false)
  • In direct mode: config.json contains the full API_URL
  • In proxy mode: config.json contains /api/v1 (relative path)
  • Use dynamic DNS resolver extracted from /etc/resolv.conf for nginx
  • Fix config.json file permissions (644) so nginx can read it
  • Update docker-compose.yaml to set ENABLE_PROXY=true

Usage

Direct mode (default):

docker run -e API_URL=https://api.example.com dispatchoor-web
# config.json: {"apiUrl": "https://api.example.com/api/v1"}

Reverse proxy mode:

docker run -e API_URL=http://api:9090 -e ENABLE_PROXY=true dispatchoor-web
# config.json: {"apiUrl": "/api/v1"}

Test plan

  • Build image: make docker-build-web
  • Test direct mode: verify config.json contains full API URL
  • Test proxy mode: verify config.json contains /api/v1
  • Verify nginx starts without upstream resolution errors
  • Verify config.json is accessible (not 403)

By default, the web container now puts the API_URL directly in
config.json, allowing the browser to connect directly to the API.
Set ENABLE_PROXY=true to use the previous behavior where nginx
proxies /api/* requests to the backend.

Changes:
- Add ENABLE_PROXY env var (default: false)
- Generate config.json with full API_URL in direct mode
- Generate config.json with /api/v1 in proxy mode
- Use dynamic DNS resolver for nginx upstream resolution
- Fix config.json file permissions (644) for nginx access
- Update docker-compose.yaml to use ENABLE_PROXY=true
@skylenet skylenet merged commit 10e66af into master Jan 12, 2026
2 checks passed
@skylenet skylenet deleted the no-reverse-proxy-api-on-ui branch January 12, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants