diff --git a/apps/dm/.env.development b/apps/dm/.env.development index 833207ed0..b8652e358 100644 --- a/apps/dm/.env.development +++ b/apps/dm/.env.development @@ -15,7 +15,7 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_REUSE_API_URL= http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api - +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do diff --git a/apps/dm/.env.local b/apps/dm/.env.local index c43f5af55..9609f33f6 100644 --- a/apps/dm/.env.local +++ b/apps/dm/.env.local @@ -6,9 +6,9 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_PORT = 3005 #NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035 NEXT_PUBLIC_PROXY_HOST = http://localhost:3005 -NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 +NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 +NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver diff --git a/apps/dm/.env.mindone b/apps/dm/.env.mindone index 7a7dc3f52..c9d033442 100644 --- a/apps/dm/.env.mindone +++ b/apps/dm/.env.mindone @@ -2,8 +2,8 @@ NEXT_PUBLIC_SITE_ID = DM NEXT_PUBLIC_PORT = 11035 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 -NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 +NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 +NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_CLAIM_NAME = Authorization diff --git a/apps/dm/.env.production b/apps/dm/.env.production index e627195cb..09aa13fb1 100644 --- a/apps/dm/.env.production +++ b/apps/dm/.env.production @@ -15,7 +15,7 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_REUSE_API_URL= http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api - +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://queen.hasuon.or.kr NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do diff --git a/apps/fo/.env.development b/apps/fo/.env.development index ffaf99feb..392ebe190 100644 --- a/apps/fo/.env.development +++ b/apps/fo/.env.development @@ -14,4 +14,5 @@ NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api -NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service \ No newline at end of file +NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr \ No newline at end of file diff --git a/apps/fo/.env.local b/apps/fo/.env.local index 1838377df..3ebe251c3 100644 --- a/apps/fo/.env.local +++ b/apps/fo/.env.local @@ -8,12 +8,15 @@ NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login NEXT_PUBLIC_VDI_DEV_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login NEXT_PUBLIC_VDI_DEV_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login NEXT_PUBLIC_PROXY_HOST = http://localhost:3000 -NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082 -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 +NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com/dc-service + +#NEXT_PUBLIC_SERVER_API_URL = http://localhost:8883/operation-service + REACT_EDITOR=atom \ No newline at end of file diff --git a/apps/fo/.env.mindone b/apps/fo/.env.mindone index 677e9b875..379bfb11e 100644 --- a/apps/fo/.env.mindone +++ b/apps/fo/.env.mindone @@ -5,8 +5,9 @@ NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300 -NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082 -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 +#NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082 +NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver diff --git a/apps/fo/.env.production b/apps/fo/.env.production index 3f5cf8bea..ec57e0f86 100644 --- a/apps/fo/.env.production +++ b/apps/fo/.env.production @@ -14,4 +14,5 @@ NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api -NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service \ No newline at end of file +NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://queen.hasuon.or.kr \ No newline at end of file diff --git a/apps/fo/app/components/api/index.ts b/apps/fo/app/components/api/index.ts index ba4e9863e..d98123308 100644 --- a/apps/fo/app/components/api/index.ts +++ b/apps/fo/app/components/api/index.ts @@ -2,15 +2,12 @@ import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "./config/env"; import { getCookie } from "@common/components/lib/cookie"; -const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || ""; - const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); export const getFetch = async (part : string, url: string) => { let reqUrl = ""; reqUrl = part === "fo" ? DEV_URL_FO+url : part === 'local' ? LOCAL_URL+url : DEV_URL_WR+url; - reqUrl = PROXY_HOST + reqUrl; const response = await fetch(reqUrl , { method: "GET", headers: { @@ -27,7 +24,7 @@ export const getFetch = async (part : string, url: string) => { } export const getFetchAreaList = async (url: string) => { - const response = await fetch(PROXY_HOST+url , { + const response = await fetch(url , { method: "GET", headers: { accept: "application/json", @@ -45,7 +42,6 @@ export const getFetchAreaList = async (url: string) => { export const postFetch = async (part : string, url: string, params: unknown) => { let reqUrl = ""; reqUrl = part === "fo" ? DEV_URL_FO+url : DEV_URL_WR+url; - reqUrl = PROXY_HOST + reqUrl; const response = await fetch(reqUrl, { method: "POST", headers: { @@ -64,7 +60,6 @@ export const postFetch = async (part : string, url: string, params: unknown) => export const putFetch = async (part : string, url: string, params: unknown) => { let reqUrl = ""; reqUrl = part === "fo" ? DEV_URL_FO+url : DEV_URL_WR+url; - reqUrl = PROXY_HOST + reqUrl; const response = await fetch(reqUrl, { method: "PUT", headers: { @@ -83,7 +78,6 @@ export const putFetch = async (part : string, url: string, params: unknown) => { export const deleteFetch = async (part : string, url: string, params: unknown) => { let reqUrl = ""; reqUrl = part === "fo" ? DEV_URL_FO+url : DEV_URL_WR+url; - reqUrl = PROXY_HOST + reqUrl; const response = await fetch(reqUrl, { method: "DELETE", headers: { diff --git a/apps/fo/app/page.tsx b/apps/fo/app/page.tsx index b1a103bca..473a7815c 100644 --- a/apps/fo/app/page.tsx +++ b/apps/fo/app/page.tsx @@ -15,7 +15,7 @@ export default function Home() { async function doLogin() { try { await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" }); - router.push("/pages/dashboard"); + window.location.href = "/pages/dashboard"; } catch (err) { console.error("로그인 실패", err); } diff --git a/apps/fo/next.config.ts b/apps/fo/next.config.ts index 35ea029a8..bc21e16a4 100644 --- a/apps/fo/next.config.ts +++ b/apps/fo/next.config.ts @@ -1,7 +1,7 @@ import type { NextConfig } from "next"; const subDomain = - process.env.NEXT_PUBLIC_SUB_DOMAIN || "http://localhost:13001"; + process.env.NEXT_PUBLIC_PROXY_HOST || "http://localhost:3000"; const nextConfig: NextConfig = { output: "standalone", @@ -22,8 +22,16 @@ const nextConfig: NextConfig = { ], afterFiles: [ { - source: "/pst/:path*", - destination: `${subDomain}/pst/:path*`, + source: "/sewerage-service/:path*", + destination: `${subDomain}/sewerage-service/:path*`, + }, + { + source: "/reuse-service/:path*", + destination: `${subDomain}/reuse-service/:path*`, + }, + { + source: "/operation-service/:path*", + destination: `${subDomain}/operation-service/:path*`, }, ], fallback: [], diff --git a/apps/fo/src/entities/auth/lib/auth-wrapper.tsx b/apps/fo/src/entities/auth/lib/auth-wrapper.tsx index 8f77aa8af..f57ae7f6d 100644 --- a/apps/fo/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/fo/src/entities/auth/lib/auth-wrapper.tsx @@ -1,17 +1,18 @@ "use client"; import { useEffect } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, usePathname } from "next/navigation"; import { client } from "@/src/shared/api"; import type { IUserInfo } from "@/src/shared/store"; import { useUserStore, getCookie } from "@/src/shared/lib"; import { ENDPOINT, AUTH_USER_ID } from "@/src/shared/config"; import { LoginApi } from "../api/login-service"; -//const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL || "http://localhost:3001/auth/login"; // 개발 환경 URL +const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL || "http://localhost:3001/auth/login"; // 개발 환경 URL const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); + const pathname = usePathname(); const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -39,14 +40,20 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - router.push("/"); // 개발시 홈으로 돌아가기 - // window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 + const hostname = window.location.hostname; + + // 개발 환경에서는 localhost 도메인 사용 + if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") + router.push("/"); // 개발시 홈으로 돌아가기 + + // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용 + if (hostname.includes("hasuon.or.kr")) window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 } } })(); - }, []); + }, [pathname]); return <>{children}; }; diff --git a/apps/sn/.env.development b/apps/sn/.env.development index cd4879013..7476f5d35 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -12,3 +12,4 @@ NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr \ No newline at end of file diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 90543d02f..610116f18 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -10,9 +10,9 @@ NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -# NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083 +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083 NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.222:8883 -NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883 \ No newline at end of file +# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883 diff --git a/apps/sn/.env.production b/apps/sn/.env.production index c46ea814c..30af3a5bb 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -9,7 +9,7 @@ NEXT_PUBLIC_PROXY_HOST = https://lion.hasuon.or.kr NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl -NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC +NEXT_PUBLIC_NGII_URL = http://172.29.143.87:80/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service -NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://queen.hasuon.or.kr diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index cd5d27e05..9851437b1 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -104,31 +104,19 @@ export function middleware(req: NextRequest) { || pathname.startsWith("/cms-service") || pathname.startsWith("/user-service") ) { - const requestHeaders = new Headers(req.headers); - const token = req.cookies.get(CLAIM_NAME)?.value; - const userId = req.cookies.get(AUTH_USER_ID)?.value; const newUrl = `${SERVER_API_URL}${pathname}`; - - if (token) requestHeaders.set(CLAIM_NAME, token); - if (userId) requestHeaders.set(AUTH_USER_ID, userId); - console.log(`[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`); - return NextResponse.rewrite(new URL(newUrl), { - headers: requestHeaders, - }); + return rewriteWith(newUrl, req, true); } if (pathname.startsWith("/dc-service")) { - const requestHeaders = new Headers(req.headers); const decodedParams = Array.from(searchParams.entries()) .map(([key, value]) => `${key}=${decodeURIComponent(value)}`) .join("&"); - const newUrl = `${DC_URL}${pathname}${decodedParams ? `?${decodedParams}` : ""}`; + const newUrl = `${DC_URL}${pathname}${decodedParams ? `?${decodedParams}` : ""}`; console.log(`[Middleware] Rewriting from '/dc-service' path to: ${newUrl}`); - return NextResponse.rewrite(new URL(newUrl), { - headers: requestHeaders, - }); + return rewriteWith(newUrl, req, true); } if (pathname.startsWith("/sewerage-service")) { diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 1d722ff48..289a97087 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, usePathname } from "next/navigation"; import { client } from "@/shared/api"; import type { IUserInfo } from "@/shared/store"; import { useUserStore } from "@/shared/lib"; @@ -14,6 +14,7 @@ const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL || "http://dev. const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); + const pathname = usePathname(); const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -41,14 +42,20 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - // router.push("/"); // 개발시 홈으로 돌아가기 - window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 + const hostname = window.location.hostname; + + // 개발 환경에서는 localhost 도메인 사용 + if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") + router.push("/"); // 개발시 홈으로 돌아가기 + + // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용 + if (hostname.includes("hasuon.or.kr")) window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 } } })(); - }, []); + }, [pathname]); return <>{children}; }; diff --git a/apps/wr/.env.development b/apps/wr/.env.development index 34ea78105..91697555c 100644 --- a/apps/wr/.env.development +++ b/apps/wr/.env.development @@ -15,6 +15,7 @@ NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA= \ No newline at end of file diff --git a/apps/wr/.env.local b/apps/wr/.env.local index e3c0e1daf..b49795259 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -6,12 +6,12 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_PROXY_HOST = http://localhost:3001 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 +NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g diff --git a/apps/wr/.env.mindone b/apps/wr/.env.mindone index f7d7445ce..c27784288 100644 --- a/apps/wr/.env.mindone +++ b/apps/wr/.env.mindone @@ -6,13 +6,13 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 +NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1 +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do diff --git a/apps/wr/.env.production b/apps/wr/.env.production index 7086521c6..361cd02f4 100644 --- a/apps/wr/.env.production +++ b/apps/wr/.env.production @@ -15,6 +15,7 @@ NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://queen.hasuon.or.kr NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA= \ No newline at end of file diff --git a/apps/wr/components/lib/api/index.ts b/apps/wr/components/lib/api/index.ts index dc1147abb..14c4a94f5 100644 --- a/apps/wr/components/lib/api/index.ts +++ b/apps/wr/components/lib/api/index.ts @@ -4,7 +4,6 @@ import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config"; import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "../config/"; import { getCookie } from "@common/components/lib/cookie"; -const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST; export const fetchType = { COMMON: "common", WR: "wr", @@ -21,7 +20,7 @@ export const getFetch = async (type: string, url: string) => { : type === fetchType.CS ? "" : DEV_URL_WR; - const apiUrl = PROXY_HOST + div + url; + const apiUrl = div + url; const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); const response = await fetch(apiUrl, { @@ -72,7 +71,7 @@ export const getFetchWithCount = async (type: string, url: string) => { : type === fetchType.CS ? "" : DEV_URL_WR; - const apiUrl = PROXY_HOST + div + url; + const apiUrl = div + url; const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); @@ -120,7 +119,7 @@ export const postFectch = async (url: string, params: any, type?: string) => { const div = type === fetchType.COMMON ? DEV_URL_FO : DEV_URL_WR; const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); - const apiUrl = PROXY_HOST + div + url; + const apiUrl = div + url; const response = await fetch(apiUrl, { method: "POST", headers: { @@ -146,7 +145,7 @@ export const putFectch = async (url: string, params: any, type?: string) => { : type === fetchType.CS ? "" : DEV_URL_WR; - const apiUrl = PROXY_HOST + div + url; + const apiUrl = div + url; const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); @@ -178,7 +177,7 @@ export const deleteFectch = async ( : type === fetchType.CS ? "" : DEV_URL_WR; - const apiUrl = PROXY_HOST + div + url; + const apiUrl = div + url; const tokenId = getCookie(AUTH_USER_ID); const Authorization = getCookie(CLAIM_NAME); diff --git a/apps/wr/next.config.ts b/apps/wr/next.config.ts index 35ea029a8..bc21e16a4 100644 --- a/apps/wr/next.config.ts +++ b/apps/wr/next.config.ts @@ -1,7 +1,7 @@ import type { NextConfig } from "next"; const subDomain = - process.env.NEXT_PUBLIC_SUB_DOMAIN || "http://localhost:13001"; + process.env.NEXT_PUBLIC_PROXY_HOST || "http://localhost:3000"; const nextConfig: NextConfig = { output: "standalone", @@ -22,8 +22,16 @@ const nextConfig: NextConfig = { ], afterFiles: [ { - source: "/pst/:path*", - destination: `${subDomain}/pst/:path*`, + source: "/sewerage-service/:path*", + destination: `${subDomain}/sewerage-service/:path*`, + }, + { + source: "/reuse-service/:path*", + destination: `${subDomain}/reuse-service/:path*`, + }, + { + source: "/operation-service/:path*", + destination: `${subDomain}/operation-service/:path*`, }, ], fallback: [], diff --git a/apps/wr/src/entities/auth/lib/auth-wrapper.tsx b/apps/wr/src/entities/auth/lib/auth-wrapper.tsx index 94d39b6e4..cf9af93cc 100644 --- a/apps/wr/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/wr/src/entities/auth/lib/auth-wrapper.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, usePathname } from "next/navigation"; import { client } from "../../../shared/api"; import type { IUserInfo } from "../../../shared/store"; import { useUserStore } from "../../../shared/lib"; @@ -10,10 +10,11 @@ import { getCookie } from "../../../shared/lib"; import { LoginApi } from "../api/login-service"; -//const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL || "http://localhost:3000/auth/login"; // 로그인 페이지 URL +const LOGIN_PAGE_URL = process.env.NEXT_PUBLIC_DEV_CM_LOGIN_PAGE_URL || "http://localhost:3000/auth/login"; // 로그인 페이지 URL const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); + const pathname = usePathname(); const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -41,14 +42,21 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - router.push("/"); // 개발시 홈으로 돌아가기 - // window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 + const hostname = window.location.hostname; + + // 개발 환경에서는 localhost 도메인 사용 + if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") + router.push("/"); // 개발시 홈으로 돌아가기 + + // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용 + if (hostname.includes("hasuon.or.kr")) + window.location.href = LOGIN_PAGE_URL; // 세션 만료 시 CM 로그인 페이지로 리다이렉트 } } })(); - }, []); + }, [pathname]); return <>{children}; };