Spaces:
AiCoderv2
/
Sleeping

akhaliq HF Staff commited on
Commit
d84050d
·
1 Parent(s): 5fd62fb

Fix API connectivity in Docker Space

Browse files

Root cause: NEXT_PUBLIC_API_URL was defaulting to 'http://localhost:8000' which made
the browser try to reach localhost instead of using Next.js proxy.

Fixes:
- Remove default value for NEXT_PUBLIC_API_URL in next.config.js
- Only set NEXT_PUBLIC_API_URL if explicitly provided
- In Docker Space, frontend uses relative URLs (empty string)
- Next.js server proxies /api/* to localhost:8000 backend
- Add console.log debugging to trace API URL resolution
- Add comments explaining Docker Space proxy architecture

This ensures:
✅ Production: Browser -> /api/models -> Next.js proxy -> localhost:8000/api/models
✅ Dev: Browser -> http://localhost:8000/api/models (direct)

3 files changed +16 -5
Files changed (3)
Dockerfile+2
frontend/next.config.js+8-3
frontend/src/lib/api.ts+6-2