diff --git a/Program.cs b/Program.cs index 8e993c1..cb67d6c 100644 --- a/Program.cs +++ b/Program.cs @@ -213,9 +213,6 @@ else // 로컬 테스트 위한 부분 (올릴떄는 켜두기) app.UseHttpsRedirection(); -// 헤더 미들웨어 부분 -app.UseMiddleware - ((object)new string[] { "iOS_AM_Connect_Key", "And_AM_Connect_Key", "Web_AM_Connect_Key" }); app.UseStaticFiles(new StaticFileOptions { @@ -229,6 +226,13 @@ app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); + +// 헤더 미들웨어 부분 +app.UseMiddleware + ((object)new string[] { "iOS_AM_Connect_Key", "And_AM_Connect_Key", "Web_AM_Connect_Key" }); + + + app.UseWebSockets(); Console.WriteLine($"[정적 파일 경로] {staticRoot}"); app.UseEndpoints(end => diff --git a/Program/Common/Auth/APIHeaderMiddleware.cs b/Program/Common/Auth/APIHeaderMiddleware.cs index f128074..224b438 100644 --- a/Program/Common/Auth/APIHeaderMiddleware.cs +++ b/Program/Common/Auth/APIHeaderMiddleware.cs @@ -34,6 +34,7 @@ namespace Back.Program.Common.Auth // 정적 파일 요청은 미들웨어 건너뜀 var path = context.Request.Path.Value; + if (path != null && (path.StartsWith("/api"))) { // Scoped 사용해서 값 가져오는 곳임 @@ -43,8 +44,8 @@ namespace Back.Program.Common.Auth foreach (var header in _headerNames) { - /// context.Request.Headers.TryGetValue(header, out var headerValue) - /// header 를 찾는데 header + // context.Request.Headers.TryGetValue(header, out var headerValue) + // header 를 찾는데 header if (context.Request.Headers.TryGetValue(header, out var headerValue) && !string.IsNullOrWhiteSpace(headerValue)) {