내부 IP로 바인딩

This commit is contained in:
hyeonsu 2025-09-04 12:27:45 +09:00
parent 8d76df1cfe
commit 22b8bdd400
2 changed files with 4 additions and 27 deletions

View File

@ -1,30 +1,7 @@
import axios, { AxiosResponse, AxiosError } from "axios";
// API 기본 URL 동적 설정 (클라이언트 사이드에서 현재 도메인 기반으로 결정)
const getApiBaseUrl = (): string => {
if (typeof window !== "undefined") {
const currentHost = window.location.hostname;
const currentPort = window.location.port;
// 외부 IP로 접근한 경우
if (currentHost === "39.117.244.52") {
return "http://39.117.244.52:8080/api";
}
// 내부 IP로 접근한 경우
else if (currentHost === "192.168.0.70") {
return "http://192.168.0.70:8080/api";
}
// localhost로 접근한 경우
else if (currentHost === "localhost" || currentHost === "127.0.0.1") {
return "http://localhost:8080/api";
}
}
// 서버 사이드 렌더링이나 기본값
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 = {

View File

@ -41,9 +41,9 @@ const nextConfig = {
];
},
// 환경 변수 (런타임에 읽기)
// 환경 변수 (런타임에 읽기) - 내부 IP로 통일
env: {
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || "http://39.117.244.52:8080/api",
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || "http://192.168.0.70:8080/api",
},
};