[🐛] 헤더 관련 로직 수정
1. 순서 변경 2. 주석 정리
This commit is contained in:
parent
2766b3489d
commit
6c8c9972b2
10
Program.cs
10
Program.cs
|
@ -213,9 +213,6 @@ else
|
||||||
// 로컬 테스트 위한 부분 (올릴떄는 켜두기)
|
// 로컬 테스트 위한 부분 (올릴떄는 켜두기)
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
// 헤더 미들웨어 부분
|
|
||||||
app.UseMiddleware<APIHeaderMiddleware>
|
|
||||||
((object)new string[] { "iOS_AM_Connect_Key", "And_AM_Connect_Key", "Web_AM_Connect_Key" });
|
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
|
@ -229,6 +226,13 @@ app.UseCors("CorsPolicy");
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
|
||||||
|
// 헤더 미들웨어 부분
|
||||||
|
app.UseMiddleware<APIHeaderMiddleware>
|
||||||
|
((object)new string[] { "iOS_AM_Connect_Key", "And_AM_Connect_Key", "Web_AM_Connect_Key" });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseWebSockets();
|
app.UseWebSockets();
|
||||||
Console.WriteLine($"[정적 파일 경로] {staticRoot}");
|
Console.WriteLine($"[정적 파일 경로] {staticRoot}");
|
||||||
app.UseEndpoints(end =>
|
app.UseEndpoints(end =>
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace Back.Program.Common.Auth
|
||||||
|
|
||||||
// 정적 파일 요청은 미들웨어 건너뜀
|
// 정적 파일 요청은 미들웨어 건너뜀
|
||||||
var path = context.Request.Path.Value;
|
var path = context.Request.Path.Value;
|
||||||
|
|
||||||
if (path != null && (path.StartsWith("/api")))
|
if (path != null && (path.StartsWith("/api")))
|
||||||
{
|
{
|
||||||
// Scoped 사용해서 값 가져오는 곳임
|
// Scoped 사용해서 값 가져오는 곳임
|
||||||
|
@ -43,8 +44,8 @@ namespace Back.Program.Common.Auth
|
||||||
|
|
||||||
foreach (var header in _headerNames)
|
foreach (var header in _headerNames)
|
||||||
{
|
{
|
||||||
/// context.Request.Headers.TryGetValue(header, out var headerValue)
|
// context.Request.Headers.TryGetValue(header, out var headerValue)
|
||||||
/// header 를 찾는데 header
|
// header 를 찾는데 header
|
||||||
if (context.Request.Headers.TryGetValue(header, out var headerValue) &&
|
if (context.Request.Headers.TryGetValue(header, out var headerValue) &&
|
||||||
!string.IsNullOrWhiteSpace(headerValue))
|
!string.IsNullOrWhiteSpace(headerValue))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user