Skip to content

Local development frontend API calls failing #446

Open

Description

@sahilds1

Steps to Reproduce

  1. Start local Docker environment: docker compose up
  2. Navigate to frontend at http://localhost:3000
  3. Trigger any API call (e.g., fetch medication list)
  4. Observe error in browser console and Vite terminal

Possible Fix: Vite proxy

Background

The API client uses relative URLs (/api/...), so requests go to the frontend's origin unless a proxy forwards them to the backend. In development, Vite runs a Node.js server that serves the React app and can proxy requests. In production, Vite compiles React into static files served by nginx or a CDN — the infrastructure handles API routing instead.

Fix

Add a proxy to frontend/vite.config.ts:

  server: {
    proxy: {
      '/api': {
        target: 'http://backend:8000',
        changeOrigin: true,
      },
    },
  },

Rebuild with docker compose down && docker compose up --build.

Activity

  1. moved this to In Progress in Balanceron Jan 20, 2026
  2. self-assigned this
    on Jan 20, 2026
  3. moved this from In Progress to Ready for Dev Review in Balanceron Jan 20, 2026
  4. added a commit that references this issue on Jan 26, 2026
  5. moved this from Ready for Dev Review to Ready for Prod Review in Balanceron Jan 27, 2026
  6. moved this from Sandbox to Develop Branch in Balanceron Feb 25, 2026
  7. moved this from Develop Branch to Sandbox in Balanceron Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

  • Status
    Sandbox

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions