Skip to content

fix: proxy /api/* from Vite dev server to the backend#65

Merged
constk merged 1 commit into
developfrom
fix/frontend-vite-api-proxy
Apr 28, 2026
Merged

fix: proxy /api/* from Vite dev server to the backend#65
constk merged 1 commit into
developfrom
fix/frontend-vite-api-proxy

Conversation

@constk
Copy link
Copy Markdown
Owner

@constk constk commented Apr 27, 2026

Summary

Hello page at http://localhost:5173 was rendering the error state with Unexpected token '<', "<!doctype "... is not valid JSON because the Vite dev server has no route for /api/v1/* and falls back to serving index.html.

Fix

frontend/vite.config.ts — add server.proxy forwarding /api/* to the backend. Target defaults to http://localhost:8000 for host-mode dev; overridable via VITE_API_PROXY_TARGET so docker-compose points at http://app:8000 (the in-network backend hostname).

docker-compose.yml — set VITE_API_PROXY_TARGET=http://app:8000 on the frontend service.

Test plan

  • npm run check clean
  • npm run lint clean
  • npm run format:check clean
  • npm run test (2 passed)
  • npm run build clean
  • Live: restart npm run dev, hit http://localhost:5173, the page should now render the green OK v0.0.0+local badge.

🤖 Generated with Claude Code

…st:5173 health-check 'Unexpected token <' error)
@constk constk merged commit 4603e90 into develop Apr 28, 2026
15 checks passed
@constk constk deleted the fix/frontend-vite-api-proxy branch April 28, 2026 02:59
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.

1 participant