외부 ip에서 접근 가능하게 수정 #14
|
|
@ -30,7 +30,7 @@ app.use(express.urlencoded({ extended: true, limit: "10mb" }));
|
|||
// CORS 설정
|
||||
app.use(
|
||||
cors({
|
||||
origin: config.cors.origin,
|
||||
origin: config.cors.origin.split(",").map((url) => url.trim()),
|
||||
credentials: true,
|
||||
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
||||
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"],
|
||||
|
|
@ -86,11 +86,13 @@ app.use(errorHandler);
|
|||
|
||||
// 서버 시작
|
||||
const PORT = config.port;
|
||||
const HOST = config.host;
|
||||
|
||||
app.listen(PORT, () => {
|
||||
logger.info(`🚀 Server is running on port ${PORT}`);
|
||||
app.listen(PORT, HOST, () => {
|
||||
logger.info(`🚀 Server is running on ${HOST}:${PORT}`);
|
||||
logger.info(`📊 Environment: ${config.nodeEnv}`);
|
||||
logger.info(`🔗 Health check: http://localhost:${PORT}/health`);
|
||||
logger.info(`🔗 Health check: http://${HOST}:${PORT}/health`);
|
||||
logger.info(`🌐 External access: http://39.117.244.52:${PORT}/health`);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ const config: Config = {
|
|||
|
||||
// CORS 설정
|
||||
cors: {
|
||||
origin: process.env.CORS_ORIGIN || "http://localhost:9771",
|
||||
credentials: process.env.CORS_CREDENTIALS === "true",
|
||||
origin: process.env.CORS_ORIGIN || "http://localhost:9771,http://192.168.0.70:5555,http://39.117.244.52:5555",
|
||||
credentials: process.env.CORS_CREDENTIALS === "true" || true,
|
||||
},
|
||||
|
||||
// 로깅 설정
|
||||
|
|
|
|||
|
|
@ -5,20 +5,17 @@ services:
|
|||
context: ../../backend-node
|
||||
dockerfile: ../docker/prod/backend.Dockerfile # 운영용 Dockerfile
|
||||
container_name: pms-backend-prod
|
||||
ports:
|
||||
- "8080:8080"
|
||||
network_mode: "host" # 호스트 네트워크 모드
|
||||
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
|
||||
- CORS_ORIGIN=http://192.168.0.70:5555
|
||||
- CORS_ORIGIN=http://192.168.0.70:5555,http://39.117.244.52:5555
|
||||
- CORS_CREDENTIALS=true
|
||||
- LOG_LEVEL=info
|
||||
# 운영용에서는 볼륨 마운트 없음 (보안상 이유)
|
||||
networks:
|
||||
- pms-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import axios, { AxiosResponse, AxiosError } from "axios";
|
||||
|
||||
// API 기본 URL 설정
|
||||
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8080/api";
|
||||
export const API_BASE_URL = "http://39.117.244.52:8080/api";
|
||||
|
||||
// JWT 토큰 관리 유틸리티
|
||||
const TokenManager = {
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ const nextConfig = {
|
|||
];
|
||||
},
|
||||
|
||||
// 환경 변수 (런타임에 읽기)
|
||||
// 환경 변수 (런타임에 읽기) - 내부 IP로 통일
|
||||
env: {
|
||||
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || "http://192.168.0.70:8080/api",
|
||||
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || "http://39.117.244.52:8080/api",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue