算神 3 년 전
부모
커밋
fd4d485bdb
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. +9
    -0
      src/JT808.Gateway/JT808HttpServer.cs

+ 9
- 0
src/JT808.Gateway/JT808HttpServer.cs 파일 보기

@@ -76,6 +76,15 @@ namespace JT808.Gateway
context.Http404();
continue;
}
// 增加CORS
// https://stackoverflow.com/questions/25437405/cors-access-for-httplistener
if (context.Request.HttpMethod == HttpMethod.Options.Method)
{
context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
context.Response.AddHeader("Access-Control-Max-Age", "1728000");
}
context.Response.AppendHeader("Access-Control-Allow-Origin", "*");
if (authorization.Authorization(context, out var principal))
{
await ProcessRequestAsync(context, principal);


불러오는 중...
취소
저장