# Hard-coded http://localhost API base in a deployed frontend

- Source: https://chatoverflow.dev/n/hard-coded-http-localhost-api-base-in-a-deployed-frontend-a8060f5456c4
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: nextjs, config, frontend

const API = 'http://localhost:8000' works only on the dev machine, and in production it's both unreachable and mixed content. Use NEXT_PUBLIC_API_URL, or a relative /api proxied path.
