From f798b290ecb019e2a66e84b3d3d7c236588ba5a0 Mon Sep 17 00:00:00 2001 From: SEAN Date: Tue, 10 Feb 2026 10:20:43 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20X-Service-Code=20=EB=AF=B8=EB=93=A4?= =?UTF-8?q?=EC=9B=A8=EC=96=B4=20=EA=B2=BD=EB=A1=9C=20=EC=A0=9C=EC=99=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auth, account, public, service 경로를 X-Service-Code 검증 대상에서 제외. device, message, push, stats, file 경로만 X-Service-Code 헤더 필요. Swagger OperationFilter도 동일하게 수정. --- SPMS.API/Filters/SpmsHeaderOperationFilter.cs | 8 ++++++-- SPMS.API/Middlewares/ServiceCodeMiddleware.cs | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SPMS.API/Filters/SpmsHeaderOperationFilter.cs b/SPMS.API/Filters/SpmsHeaderOperationFilter.cs index 1787f3e..d3f538c 100644 --- a/SPMS.API/Filters/SpmsHeaderOperationFilter.cs +++ b/SPMS.API/Filters/SpmsHeaderOperationFilter.cs @@ -15,8 +15,12 @@ public class SpmsHeaderOperationFilter : IOperationFilter operation.Parameters ??= new List(); - // /v1/in/* 내부 API는 X-Service-Code 필요 - if (relativePath.StartsWith("v1/in")) + // v1/in/* 중 X-Service-Code가 필요한 경로만 (device, message, push, stats, file) + if (relativePath.StartsWith("v1/in/device") || + relativePath.StartsWith("v1/in/message") || + relativePath.StartsWith("v1/in/push") || + relativePath.StartsWith("v1/in/stats") || + relativePath.StartsWith("v1/in/file")) { operation.Parameters.Add(new OpenApiParameter { diff --git a/SPMS.API/Middlewares/ServiceCodeMiddleware.cs b/SPMS.API/Middlewares/ServiceCodeMiddleware.cs index 241df27..d47aa9a 100644 --- a/SPMS.API/Middlewares/ServiceCodeMiddleware.cs +++ b/SPMS.API/Middlewares/ServiceCodeMiddleware.cs @@ -13,6 +13,10 @@ public class ServiceCodeMiddleware public async Task InvokeAsync(HttpContext context, IServiceRepository serviceRepository) { if (context.Request.Path.StartsWithSegments("/v1/out") || + context.Request.Path.StartsWithSegments("/v1/in/auth") || + context.Request.Path.StartsWithSegments("/v1/in/account") || + context.Request.Path.StartsWithSegments("/v1/in/public") || + context.Request.Path.StartsWithSegments("/v1/in/service") || context.Request.Path.StartsWithSegments("/swagger") || context.Request.Path.StartsWithSegments("/health")) { -- 2.45.1