diff --git a/apps/dm/.env.development b/apps/dm/.env.development deleted file mode 100644 index 5a8cd95ea..000000000 --- a/apps/dm/.env.development +++ /dev/null @@ -1,22 +0,0 @@ -# 공단 개발 -NEXT_PUBLIC_SITE_ID = DM -NEXT_PUBLIC_PORT = 3000 -NEXT_PUBLIC_PROXY_HOST = https://devreuse.hasuon.or.kr -NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 -NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 -NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 -NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload -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_CLAIM_NAME = Authorization -NEXT_PUBLIC_AUTH_USER_ID = token-id -NEXT_PUBLIC_ACCESS_TOKEN = access-token -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://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} -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/auth/login - - -NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do -NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA= diff --git a/apps/dm/.env.local b/apps/dm/.env.local index 37305135c..236b5b5ad 100644 --- a/apps/dm/.env.local +++ b/apps/dm/.env.local @@ -14,8 +14,9 @@ NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1 -NEXT_PUBLIC_NGII_URL = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} -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 +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login diff --git a/apps/dm/.env.mindone b/apps/dm/.env.mindone index 7b20deed6..1b7c8cee8 100644 --- a/apps/dm/.env.mindone +++ b/apps/dm/.env.mindone @@ -11,8 +11,9 @@ NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1 -NEXT_PUBLIC_NGII_URL = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} -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 +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API # NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login diff --git a/apps/dm/.env.production b/apps/dm/.env.production index 9659ef2a2..6f3cabc41 100644 --- a/apps/dm/.env.production +++ b/apps/dm/.env.production @@ -1,19 +1,22 @@ # 공단 운영 NEXT_PUBLIC_SITE_ID = DM NEXT_PUBLIC_PORT = 3000 +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token +#NEXT_PUBLIC_PROXY_HOST = https://devreuse.hasuon.or.kr +#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload 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_CLAIM_NAME = Authorization -NEXT_PUBLIC_AUTH_USER_ID = token-id -NEXT_PUBLIC_ACCESS_TOKEN = access-token -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_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api -NEXT_PUBLIC_NGII_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} +NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service +NEXT_PUBLIC_NGII_URL = http://172.29.143.87 +NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do diff --git a/apps/dm/middleware.ts b/apps/dm/middleware.ts index 8616a6e80..b013082d3 100644 --- a/apps/dm/middleware.ts +++ b/apps/dm/middleware.ts @@ -109,7 +109,7 @@ export function middleware(req: NextRequest) { const url = req.nextUrl.clone(); url.searchParams.set("TYPENAME", typename.replace("hasudo:", "")); queryParams = url.searchParams.toString(); - newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; + newUrl = `${SEWERAGE_API_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; } console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); diff --git a/apps/fo/.env.development b/apps/fo/.env.development deleted file mode 100644 index 8e703c8ce..000000000 --- a/apps/fo/.env.development +++ /dev/null @@ -1,19 +0,0 @@ -# 공단 개발 -NEXT_PUBLIC_SITE_ID = FO -NEXT_PUBLIC_PORT = 3000 -NEXT_PUBLIC_CLAIM_NAME = Authorization -NEXT_PUBLIC_AUTH_USER_ID = token-id -NEXT_PUBLIC_ACCESS_TOKEN = access-token -NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_PROXY_HOST = https://devlarva.hasuon.or.kr -NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service -NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 -NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 -NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload -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 -NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login -NEXT_PUBLIC_NGII_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} diff --git a/apps/fo/.env.local b/apps/fo/.env.local index 0277a2def..17c6c38cd 100644 --- a/apps/fo/.env.local +++ b/apps/fo/.env.local @@ -4,22 +4,17 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -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_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login 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/ 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_NGII_URL = https://map.ngii.go.kr/openapi/Gettile.do?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} -NEXT_PUBLIC_NGII_URL = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} - -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_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} #NEXT_PUBLIC_SERVER_API_URL = http://localhost:8883/operation-service diff --git a/apps/fo/.env.mindone b/apps/fo/.env.mindone index 7898d8131..d2258aaf3 100644 --- a/apps/fo/.env.mindone +++ b/apps/fo/.env.mindone @@ -5,13 +5,14 @@ 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_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login #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/ 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 = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com/dc-service -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api -NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login \ No newline at end of file +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} diff --git a/apps/fo/.env.production b/apps/fo/.env.production index 5cbd3e14e..45e179066 100644 --- a/apps/fo/.env.production +++ b/apps/fo/.env.production @@ -5,6 +5,8 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token +#NEXT_PUBLIC_PROXY_HOST = https://devlarva.hasuon.or.kr +#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 @@ -12,6 +14,7 @@ NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload 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_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service -NEXT_PUBLIC_NGII_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} +NEXT_PUBLIC_NGII_URL = http://172.29.143.87 +NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} diff --git a/apps/fo/app/api/auth/logout/route.ts b/apps/fo/app/api/auth/logout/route.ts new file mode 100644 index 000000000..8832d35a3 --- /dev/null +++ b/apps/fo/app/api/auth/logout/route.ts @@ -0,0 +1,17 @@ +import { cookies } from "next/headers"; +import { NextResponse } from "next/server"; +import { + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, + REFRESH_TOKEN, +} from "@/src/shared/config"; + +export async function POST() { + const cookieStore = await cookies(); + cookieStore.delete(ACCESS_TOKEN); + cookieStore.delete(REFRESH_TOKEN); + cookieStore.delete(AUTH_USER_ID); + cookieStore.delete(CLAIM_NAME); + return NextResponse.json({ message: "Logged out" }, { status: 200 }); +} diff --git a/apps/fo/app/pages/(map-layout)/map/page.tsx b/apps/fo/app/pages/(map-layout)/map/page.tsx index 984a8afa7..86b6ee508 100644 --- a/apps/fo/app/pages/(map-layout)/map/page.tsx +++ b/apps/fo/app/pages/(map-layout)/map/page.tsx @@ -55,7 +55,7 @@ const Map = () => { const fetchData = async () => { try { - const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map`; + const API_URL = "/sewerage-service/api/v1/map"; const reqUrl = `${API_URL}/lyrStngs/FO_NETWORK`; const response = await fetch(reqUrl, { method: "GET", diff --git a/apps/fo/middleware.ts b/apps/fo/middleware.ts index d532e3f19..cca7ecd22 100644 --- a/apps/fo/middleware.ts +++ b/apps/fo/middleware.ts @@ -9,6 +9,18 @@ const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const serverApiUrl = SERVER_API_CS_URL; const DC_URL = process.env.NEXT_PUBLIC_DC_URL || ""; +/** 공통: URLSearchParams의 값을 decodeURIComponent 적용하여 querystring 생성 */ +function toDecodedQueryString(params: URLSearchParams): string { + const entries: string[][] = Array.from(params.entries()).map(([k, v]) => { + try { + return [k, decodeURIComponent(v)] as string[]; + } catch { + return [k, v] as string[]; + } + }); + return new URLSearchParams(entries).toString(); +} + /** 공통: 요청 헤더에 쿠키 기반 인증 값 주입 */ function buildAuthHeaders(req: NextRequest): Headers { const requestHeaders = new Headers(req.headers); @@ -75,7 +87,7 @@ export function middleware(req: NextRequest) { const url = req.nextUrl.clone(); url.searchParams.set('TYPENAME', typename.replace("hasudo:","")); queryParams = url.searchParams.toString(); - newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; + newUrl = `${SEWERAGE_API_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; } console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); @@ -136,10 +148,14 @@ export function middleware(req: NextRequest) { return rewriteRequest; } - // if (pathname === "/") { - // return NextResponse.redirect(new URL("/pages/dashboard", req.url)); - // } - // return NextResponse.next(); + if (pathname.startsWith("/ngii-server")) { + const decodedQuery = toDecodedQueryString(searchParams); + const newUrl = `${process.env.NEXT_PUBLIC_NGII_URL}${pathname.replace("/ngii-server", "")}${decodedQuery ? `?${decodedQuery}` : ""}`; + console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + + return NextResponse.next(); } export const config = { @@ -154,5 +170,6 @@ export const config = { "/operation-service/:path*", "/reuse-service/:path*", "/dc-service/:path*", + "/ngii-server/:path*", ], }; diff --git a/apps/fo/next.config.ts b/apps/fo/next.config.ts index 4fc617d21..709fd3cf6 100644 --- a/apps/fo/next.config.ts +++ b/apps/fo/next.config.ts @@ -36,6 +36,10 @@ const nextConfig: NextConfig = { source: "/operation-service/:path*", destination: `${subDomain}/operation-service/:path*`, }, + { + source: "/ngii-server/:path*", + destination: `${subDomain}/ngii-server/:path*`, + }, ], fallback: [], }; diff --git a/apps/sn/.env.development b/apps/sn/.env.development deleted file mode 100644 index 7e2c9f239..000000000 --- a/apps/sn/.env.development +++ /dev/null @@ -1,15 +0,0 @@ -# 공단 개발 -NEXT_PUBLIC_SITE_ID = SN -NEXT_PUBLIC_PORT = 3000 -NEXT_PUBLIC_CLAIM_NAME = Authorization -NEXT_PUBLIC_AUTH_USER_ID = token-id -NEXT_PUBLIC_ACCESS_TOKEN = access-token -NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_PROXY_HOST = https://devlion.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://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} -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 -NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login \ No newline at end of file diff --git a/apps/sn/.env.local b/apps/sn/.env.local index dda9b2148..c83e4fb68 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -8,7 +8,8 @@ NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 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&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} -NEXT_PUBLIC_NGII_URL = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} 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_DC_URL = https://apigateway.apps.rsonesoft.com diff --git a/apps/sn/.env.mindone b/apps/sn/.env.mindone index 244b8f7e3..7010ce026 100644 --- a/apps/sn/.env.mindone +++ b/apps/sn/.env.mindone @@ -8,6 +8,7 @@ NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_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 = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083 NEXT_PUBLIC_DC_URL = https://apigateway.apps.rsonesoft.com \ No newline at end of file diff --git a/apps/sn/.env.production b/apps/sn/.env.production index d96ede8cd..004fc8701 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -5,10 +5,14 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token +#NEXT_PUBLIC_PROXY_HOST = https://devlion.hasuon.or.kr +#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login +NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login 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://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} +NEXT_PUBLIC_NGII_URL = http://172.29.143.87 +NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} 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 diff --git a/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts b/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts index b93b6fb47..8ffe06de8 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts +++ b/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts @@ -10,8 +10,8 @@ * - 데이터 매핑 및 코드 변환 (시도/시군구, 보고서 유형 등) * * 🔗 사용 API - * - 보고서 파일 조회: GET /api/v1/dc/file (dc-service) - * - 파일 다운로드: GET /api/v1/dc/file/download (dc-service) + * - 보고서 파일 조회: GET /api/v1/file (dc-service) + * - 파일 다운로드: GET /api/v1/fileDownload (dc-service) */ import { getDcData } from '@/components/lib/api'; import { fileDownload } from '@/utils'; @@ -117,7 +117,7 @@ export default function useReportTab() { return []; } const queryString = 'clsfSystmSn=' + clsfSystmSn; - const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); + const result = await getDcData(`/api/v1/file${queryString ? `?${queryString}` : ''}`); return result; }; @@ -146,7 +146,7 @@ export default function useReportTab() { return; } const queryString = 'filePath=' + encodeURIComponent(filePath); - const responseBlob = await getDcData(`/api/v1/dc/file/download${queryString ? `?${queryString}` : ''}`, "blob"); + const responseBlob = await getDcData(`/api/v1/fileDownload${queryString ? `?${queryString}` : ''}`, "blob"); fileDownload(responseBlob, fileName); } diff --git a/apps/sn/app/api/auth/logout/route.ts b/apps/sn/app/api/auth/logout/route.ts new file mode 100644 index 000000000..fdcc9df7c --- /dev/null +++ b/apps/sn/app/api/auth/logout/route.ts @@ -0,0 +1,17 @@ +import { cookies } from "next/headers"; +import { NextResponse } from "next/server"; +import { + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, + REFRESH_TOKEN, +} from "@/shared/config"; + +export async function POST() { + const cookieStore = await cookies(); + cookieStore.delete(ACCESS_TOKEN); + cookieStore.delete(REFRESH_TOKEN); + cookieStore.delete(AUTH_USER_ID); + cookieStore.delete(CLAIM_NAME); + return NextResponse.json({ message: "Logged out" }, { status: 200 }); +} diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index fb6fb880d..13b94a86e 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -131,6 +131,13 @@ export function middleware(req: NextRequest) { return rewriteRequest; } + if (pathname.startsWith("/ngii-server")) { + const decodedQuery = toDecodedQueryString(searchParams); + const newUrl = `${process.env.NEXT_PUBLIC_NGII_URL}${pathname.replace("/ngii-server", "")}${decodedQuery ? `?${decodedQuery}` : ""}`; + console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + return NextResponse.next(); } @@ -144,6 +151,7 @@ export const config = { "/cms-service/:path*", "/dc-service/:path*", "/sewerage-service/:path*", + "/ngii-server/:path*", ], }; diff --git a/apps/wr/.env.development b/apps/wr/.env.development deleted file mode 100644 index 676f62eee..000000000 --- a/apps/wr/.env.development +++ /dev/null @@ -1,21 +0,0 @@ -# 공단 개발 -NEXT_PUBLIC_SITE_ID = WR -NEXT_PUBLIC_PORT = 3000 -NEXT_PUBLIC_CLAIM_NAME = Authorization -NEXT_PUBLIC_AUTH_USER_ID = token-id -NEXT_PUBLIC_ACCESS_TOKEN = access-token -NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_PROXY_HOST = https://devtiger.hasuon.or.kr -NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 -NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 -NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 -NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload -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_NGII_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} -NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login - -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 6758da7da..18a2464c8 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -12,8 +12,9 @@ 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: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 = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_FINDADRESS_URL = https://business.juso.go.kr/addrlink/addrLinkApi.do NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= diff --git a/apps/wr/.env.mindone b/apps/wr/.env.mindone index 43ddda992..48f2b870e 100644 --- a/apps/wr/.env.mindone +++ b/apps/wr/.env.mindone @@ -12,8 +12,9 @@ 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: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 = http://con.mind-one.co.kr:11083/sewerage-service/api/v1/basemap?apiKey=04trYP9_xwLAfALjwZ-B8g&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&TileMatrix={z}&TileCol={x}&TileRow={y} +NEXT_PUBLIC_SEWERAGE_API_URL = http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API +NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr +NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do NEXT_PRIVATE_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= diff --git a/apps/wr/.env.production b/apps/wr/.env.production index aaabbe7b1..2d7a96b90 100644 --- a/apps/wr/.env.production +++ b/apps/wr/.env.production @@ -5,6 +5,8 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token +#NEXT_PUBLIC_PROXY_HOST = https://devtiger.hasuon.or.kr +#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 @@ -12,8 +14,9 @@ NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload 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_NGII_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service/api/v1/basemap?apiKey=BDE2BEF39DAFEC293AB6730150F222AC&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=korean_map&style=korean&tilematrixset=EPSG:5179&layer=korean_map&TileMatrix={z}&TileCol={y}&TileRow={x} +NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service +NEXT_PUBLIC_NGII_URL = http://172.29.143.87 +NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} 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/app/(map-layout)/service/map.ts b/apps/wr/app/(map-layout)/service/map.ts index 8c22207be..326f10c75 100644 --- a/apps/wr/app/(map-layout)/service/map.ts +++ b/apps/wr/app/(map-layout)/service/map.ts @@ -2,8 +2,9 @@ /** * 관망도 API */ -const API_URL = '/sewerage-service/v1/map'; - + const API_URL = `/sewerage-service/api/v1/map` +//const API_URL = "http://con.mind-one.co.kr:11083/sewerage-service/api/v1/map"; + export type LyrStngProps = { lyr_sn: string lyr_nm: string diff --git a/apps/wr/app/(popUp-layout)/splyPopup/service/map.ts b/apps/wr/app/(popUp-layout)/splyPopup/service/map.ts index 9d58f65a7..605bae620 100644 --- a/apps/wr/app/(popUp-layout)/splyPopup/service/map.ts +++ b/apps/wr/app/(popUp-layout)/splyPopup/service/map.ts @@ -30,7 +30,7 @@ export type LyrStngProps = { export const mapService = { //레이어 설정 조회 getLyrStngs: async () => { - const response = await fetch(`${DEV_URL_SN}/v1/map/lyrStngs/DM_NETWORK`, { + const response = await fetch(`${DEV_URL_SN}/api/v1/map/lyrStngs/DM_NETWORK`, { method: 'GET', headers: { 'Accept': 'application/json', diff --git a/apps/wr/app/api/auth/logout/route.ts b/apps/wr/app/api/auth/logout/route.ts new file mode 100644 index 000000000..8832d35a3 --- /dev/null +++ b/apps/wr/app/api/auth/logout/route.ts @@ -0,0 +1,17 @@ +import { cookies } from "next/headers"; +import { NextResponse } from "next/server"; +import { + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, + REFRESH_TOKEN, +} from "@/src/shared/config"; + +export async function POST() { + const cookieStore = await cookies(); + cookieStore.delete(ACCESS_TOKEN); + cookieStore.delete(REFRESH_TOKEN); + cookieStore.delete(AUTH_USER_ID); + cookieStore.delete(CLAIM_NAME); + return NextResponse.json({ message: "Logged out" }, { status: 200 }); +} diff --git a/apps/wr/components/lib/config/index.ts b/apps/wr/components/lib/config/index.ts index 979862f12..85a3340fe 100644 --- a/apps/wr/components/lib/config/index.ts +++ b/apps/wr/components/lib/config/index.ts @@ -21,7 +21,7 @@ export const LOCAL_URL_WR = PROXY_HOST + `/api/v1`; export const DEV_URL_WR = '/reuse-service'; export const DEV_URL_FO = '/operation-service'; //export const DEV_URL_FO = SERVER_API_FO_URL; -export const DEV_URL_SN = '/sewerage-service/api'; +export const DEV_URL_SN = '/sewerage-service'; export const LOCAL_URL = PROXY_HOST; export const CS_URL = SERVER_API_CS_URL; export const CS_TUS_UPLOAD = SERVER_API_CS_TUS_URL; diff --git a/apps/wr/middleware.ts b/apps/wr/middleware.ts index 0c108ad76..40bdd0f20 100644 --- a/apps/wr/middleware.ts +++ b/apps/wr/middleware.ts @@ -13,6 +13,18 @@ const OPERATION_API_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL || ""; const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || ""; const AdressKey = process.env.NEXT_PRIVATE_WR_ADDRESS_KEY || ""; +/** 공통: URLSearchParams의 값을 decodeURIComponent 적용하여 querystring 생성 */ +function toDecodedQueryString(params: URLSearchParams): string { + const entries: string[][] = Array.from(params.entries()).map(([k, v]) => { + try { + return [k, decodeURIComponent(v)] as string[]; + } catch { + return [k, v] as string[]; + } + }); + return new URLSearchParams(entries).toString(); +} + /** 공통: 요청 헤더에 쿠키 기반 인증 값 주입 */ function buildAuthHeaders(req: NextRequest): Headers { const requestHeaders = new Headers(req.headers); @@ -106,7 +118,7 @@ export function middleware(req: NextRequest) { if (startYmd) url.searchParams.set("startYmd", startYmd); if (endYmd) url.searchParams.set("endYmd", endYmd); queryParams = url.searchParams.toString(); - newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; + newUrl = `${SEWERAGE_API_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; } //console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); @@ -115,7 +127,7 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/sewerage-service")) { const queryParams = searchParams.toString(); - const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service/api", "")}${ + const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service", "")}${ queryParams ? `?${queryParams}` : "" }`; console.log(`[Middleware] Rewriting from '/sewerage-service' path to: ${newUrl}`); @@ -160,6 +172,12 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } + if (pathname.startsWith("/ngii-server")) { + const decodedQuery = toDecodedQueryString(searchParams); + const newUrl = `${process.env.NEXT_PUBLIC_NGII_URL}${pathname.replace("/ngii-server", "")}${decodedQuery ? `?${decodedQuery}` : ""}`; + console.log(`[Middleware] Rewriting from '${pathname}' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } return NextResponse.next(); } @@ -175,6 +193,7 @@ export const config = { "/reuse-service/:path*", "/operation-service/:path*", "/bussiness-juso-service/:path*", + "/ngii-server/:path*", "/" ], }; diff --git a/apps/wr/next.config.ts b/apps/wr/next.config.ts index 4fc617d21..709fd3cf6 100644 --- a/apps/wr/next.config.ts +++ b/apps/wr/next.config.ts @@ -36,6 +36,10 @@ const nextConfig: NextConfig = { source: "/operation-service/:path*", destination: `${subDomain}/operation-service/:path*`, }, + { + source: "/ngii-server/:path*", + destination: `${subDomain}/ngii-server/:path*`, + }, ], fallback: [], }; diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index 1dbc34c2d..e8e05f037 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -41,7 +41,8 @@ GisApp.GOOGLE_HYBRID_URL = `https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}&k GisApp.GOOGLE_3D_URL = `https://tile.googleapis.com/v1/3dtiles/root.json?key=${GisApp.GOOGLE_API_KEY}`; // NGII 정보(배경지도) -GisApp.NGII_WMTS_URL = process.env.NEXT_PUBLIC_NGII_URL; +//GisApp.NGII_WMTS_URL = process.env.NEXT_PUBLIC_NGII_URL; +GisApp.NGII_WMTS_URL = `/ngii-server/openapi/Gettile.do?apikey=${process.env.NEXT_PUBLIC_NGII_PARAM}`; GisApp.EMAP_URL = '/emap/'; GisApp.EMAP_SATELLITE_URL = '/emap/satellite/'; @@ -149,8 +150,6 @@ GisApp.core.prototype = { const resolutions = [1044.48, 522.24, 261.12, 130.56, 65.28, 32.64, 16.32, 8.16, 4.08, 2.04, 1.02, 0.51, 0.255]; const matrixIds = ["L06", "L07", "L08", "L09", "L10", "L11", "L12", "L13", "L14", "L15", "L16", "L17", "L18"]; - - const templateUrl = process.env.NEXT_PUBLIC_NGII_URL; const tileGrid = new WMTSTileGrid({ origin: getTopLeft(projection.getExtent()), resolutions: resolutions, @@ -168,25 +167,13 @@ GisApp.core.prototype = { matrixSet: 'EPSG:5179', format: 'image/png', style: 'korean', - /* - tileUrlFunction: (tileCoord) => { - const [z, x, y] = tileCoord; - const matrix = matrixIds[z]; - const replacedUrl = templateUrl - .replace("{z}", matrix) - .replace("{x}", x) - .replace("{y}", y); // 여기서는 교환 안 함 — env 템플릿이 담당 - console.log('++++++',replacedUrl) - return replacedUrl; - }, - */ }); wmtsSource.setTileUrlFunction((tileCoord) => { const [z, x, y] = tileCoord; const matrix = matrixIds[z]; - console.log(templateUrl.replace("{z}", matrix).replace("{x}", x).replace("{y}", y)); - return templateUrl + console.log(GisApp.NGII_WMTS_URL.replace("{z}", matrix).replace("{x}", x).replace("{y}", y)); + return GisApp.NGII_WMTS_URL .replace("{z}", matrix) .replace("{x}", x) .replace("{y}", y);