fix(frontend): use relative API URL so browser works from any host
NEXT_PUBLIC_API_URL was hardcoded to http://localhost:8083/api which gets baked into webpack bundles at build time. NEXT_PUBLIC_* vars run in the browser, so "localhost" resolves to the *user's own PC*, not the office host running the container — connect refused for anyone hitting the site over Tailscale or LAN. Use a relative URL (/api) and let next dev's rewrites proxy to SERVER_API_URL (invyone-backend-spring:8081 inside invyone-net). This way the request always lands on whatever host the browser is already talking to (localhost / 100.126.230.80 / public domain), and the Next dev server forwards it to the backend container. Verified: POST /api/auth/login from browser path returns the spring controller's 400 response, confirming the full browser → frontend → backend chain works. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,10 @@ services:
|
||||
- "9772:3000"
|
||||
environment:
|
||||
NODE_ENV: development
|
||||
# 브라우저(클라이언트)에서 API 호출용 — 호스트에서 보이는 포트
|
||||
NEXT_PUBLIC_API_URL: http://localhost:8083/api
|
||||
# 서버사이드(SSR) 호출용 — 컨테이너 네트워크 내부 이름
|
||||
# 브라우저는 상대경로로 호출 → next dev server가 rewrites 로 컨테이너 내부 backend 로 프록시
|
||||
# (절대 URL 박으면 호스트/IP 가 머신마다 달라서 다른 머신에서 접속 시 깨짐)
|
||||
NEXT_PUBLIC_API_URL: /api
|
||||
# 서버사이드(SSR/rewrites)에서 backend 호출용 — 컨테이너 네트워크 내부 이름
|
||||
SERVER_API_URL: http://invyone-backend-spring:8081
|
||||
NODE_OPTIONS: --max-old-space-size=8192
|
||||
NEXT_TELEMETRY_DISABLED: "1"
|
||||
|
||||
Reference in New Issue
Block a user