Fix LAN API access and dev proxy routing

This commit is contained in:
2026-03-01 14:08:48 -03:00
parent 48cfc79b5f
commit 3d280396ae
6 changed files with 15 additions and 13 deletions

View File

@@ -116,10 +116,9 @@ Frontend runtime API target:
- `VITE_API_BASE` in `docker-compose.yml` frontend service (optional override)
- `VITE_API_TOKEN` in `docker-compose.yml` frontend service (optional compatibility fallback only)
When `VITE_API_BASE` is unset, frontend API helpers resolve the backend URL dynamically as:
- `http://<current-frontend-hostname>:8000/api/v1`
When `VITE_API_BASE` is unset, frontend API helpers call relative `/api/v1` paths and the Vite dev server proxy forwards requests to `VITE_DEV_PROXY_TARGET` (defaults to `http://api:8000` in docker-compose).
This keeps development access working when the UI is opened through a LAN IP instead of `localhost`.
This avoids browser cross-origin/CORS failures for LAN-hosted development.
Frontend API authentication behavior:
- `frontend/src/lib/api.ts` resolves bearer tokens at request time in this order: