임시 commit

This commit is contained in:
ljpark
2025-10-22 12:56:42 +09:00
parent 4c07b1b044
commit b8a8ca4126
9 changed files with 49 additions and 8 deletions
+2 -1
View File
@@ -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=
+19
View File
@@ -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*",
"/"
],
};
+4
View File
@@ -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: [],
};