From b8a8ca412647e18e06b028a28cd633ae9c096dd2 Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 22 Oct 2025 12:56:42 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=84=EC=8B=9C=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/next.config.ts | 4 ++++ apps/sn/.env.local | 3 ++- apps/sn/.env.production | 5 ++++- .../map/searchModal/useReportTab.ts | 8 ++++---- apps/sn/middleware.ts | 8 ++++++++ apps/wr/.env.production | 3 ++- apps/wr/middleware.ts | 19 +++++++++++++++++++ apps/wr/next.config.ts | 4 ++++ .../src/ui/map/lib/gis.core.js | 3 ++- 9 files changed, 49 insertions(+), 8 deletions(-) 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.local b/apps/sn/.env.local index dda9b2148..d2daa1dca 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 = 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_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.production b/apps/sn/.env.production index d96ede8cd..7da15e8bb 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -8,7 +8,10 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token 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/openapi/GetTile?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://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=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 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/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.production b/apps/wr/.env.production index aaabbe7b1..eeb049faf 100644 --- a/apps/wr/.env.production +++ b/apps/wr/.env.production @@ -13,7 +13,8 @@ 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_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=EPSG:5179&layer=korean_map&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/middleware.ts b/apps/wr/middleware.ts index 0c108ad76..047b20ca3 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); @@ -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..b079c82f2 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?${process.env.NEXT_PUBLIC_NGII_PARAM}`; GisApp.EMAP_URL = '/emap/'; GisApp.EMAP_SATELLITE_URL = '/emap/satellite/';