diff --git a/docker/prod/docker-compose.backend.prod.yml b/docker/prod/docker-compose.backend.prod.yml index 4bd7a8be..78e5e994 100644 --- a/docker/prod/docker-compose.backend.prod.yml +++ b/docker/prod/docker-compose.backend.prod.yml @@ -10,7 +10,6 @@ services: environment: - NODE_ENV=production - PORT=8080 - - HOST=0.0.0.0 - DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm - JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024 - JWT_EXPIRES_IN=24h diff --git a/frontend/lib/api/client.ts b/frontend/lib/api/client.ts index c73c53eb..a141be3f 100644 --- a/frontend/lib/api/client.ts +++ b/frontend/lib/api/client.ts @@ -1,29 +1,7 @@ import axios, { AxiosResponse, AxiosError } from "axios"; -// API 기본 URL 동적 설정 - 접속 위치에 따라 최적 경로 선택 -const getApiBaseUrl = (): string => { - if (typeof window !== "undefined") { - const currentHost = window.location.hostname; - - // 외부 IP로 접근한 경우 - 외부 IP로 API 호출 - if (currentHost === "39.117.244.52") { - return "http://39.117.244.52:8080/api"; - } - // 내부 IP로 접근한 경우 - 내부 IP로 API 호출 - else if (currentHost === "192.168.0.70") { - return "http://192.168.0.70:8080/api"; - } - // localhost로 접근한 경우 - localhost로 API 호출 - else if (currentHost === "localhost" || currentHost === "127.0.0.1") { - return "http://localhost:8080/api"; - } - } - - // 서버 사이드 렌더링이나 기본값 - 외부 IP 사용 - return process.env.NEXT_PUBLIC_API_URL || "http://39.117.244.52:8080/api"; -}; - -export const API_BASE_URL = getApiBaseUrl(); +// API 기본 URL 설정 - 모든 접근에서 내부 IP 사용 (Option B) +export const API_BASE_URL = "http://192.168.0.70:8080/api"; // JWT 토큰 관리 유틸리티 const TokenManager = { @@ -65,7 +43,6 @@ apiClient.interceptors.request.use( tokenStart: token ? token.substring(0, 30) + "..." : "없음", url: config.url, method: config.method, - baseURL: config.baseURL, }); if (token && !TokenManager.isTokenExpired(token)) { @@ -115,9 +92,7 @@ apiClient.interceptors.request.use( } } - // TypeScript 안전성을 위한 null 체크 - const fullUrl = `${config.baseURL || ""}${config.url || ""}`; - console.log("📡 API 요청:", config.method?.toUpperCase(), fullUrl, config.params, config.data); + console.log("📡 API 요청:", config.method?.toUpperCase(), config.url, config.params, config.data); console.log("📋 요청 헤더:", config.headers); return config; },