From d910dcce914269169efd14079c8dc4222a807bc8 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Thu, 28 Aug 2025 15:22:10 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EA=B2=80=EC=83=89=20=EB=AF=B8=EB=93=A4?= =?UTF-8?q?=EC=9B=A8=EC=96=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/.env.development | 2 ++ apps/wr/.env.local | 6 ++++++ apps/wr/.env.production | 3 +++ apps/wr/middleware.ts | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+) diff --git a/apps/wr/.env.development b/apps/wr/.env.development index ceaf190df..d3ec10727 100644 --- a/apps/wr/.env.development +++ b/apps/wr/.env.development @@ -27,3 +27,5 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token 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_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= diff --git a/apps/wr/.env.local b/apps/wr/.env.local index 4d8937ea6..547195433 100644 --- a/apps/wr/.env.local +++ b/apps/wr/.env.local @@ -16,6 +16,12 @@ 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_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM= + + NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 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 # 박이정 diff --git a/apps/wr/.env.production b/apps/wr/.env.production index 4a0754665..295ba7ea9 100644 --- a/apps/wr/.env.production +++ b/apps/wr/.env.production @@ -16,6 +16,9 @@ NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BE NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api +NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do +NEXT_PUBLIC_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA= + diff --git a/apps/wr/middleware.ts b/apps/wr/middleware.ts index 7758ec5ec..716a851b8 100644 --- a/apps/wr/middleware.ts +++ b/apps/wr/middleware.ts @@ -10,6 +10,8 @@ const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const REUSE_API_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL || ""; 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_PUBLIC_WR_ADDRESS_KEY || ""; export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; @@ -148,6 +150,24 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } + + if (pathname.startsWith("/bussiness-juso-service")) { + console.log('AdressKey ', AdressKey) + const params = new URLSearchParams({ + currentPage: "1", // 원하는 페이지 + countPerPage: "5", // 페이지당 결과 수 + keyword: searchParams.get("keyword") || "", // 검색어(주소) + confmKey: AdressKey, // 인증키 인터넷용 패쇄망용은 따로 발급 필요 즉 middleware에서 치환해서 사용해야할듯 + resultType: "json", // 결과 형식 기본은 xml + }); + const newUrl = `${BUSINESS_JUSO_API_URL}?${params.toString()}`; + console.log(`[Middleware] Request to business.juso.go.kr`); + console.log(req.url); + console.log(`[Middleware] Rewriting from '/business.juso.go.kr' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + + return NextResponse.next(); } @@ -161,6 +181,7 @@ export const config = { "/sewerage-service/:path*", "/reuse-service/:path*", "/operation-service/:path*", + "/bussiness-juso-service/:path*", "/" ], };