|
@@ -35,9 +35,9 @@ namespace Middleware
|
|
|
try
|
|
|
{
|
|
|
// 设置允许跨域的域名、方法等
|
|
|
- // context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
|
|
- // context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
|
- // context.Response.Headers.Add("Access-Control-Allow-Headers", "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization");
|
|
|
+ context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
|
|
+ context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
|
+ context.Response.Headers.Add("Access-Control-Allow-Headers", "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization");
|
|
|
|
|
|
// 如果请求方法是预检请求(OPTIONS),则直接返回成功状态码
|
|
|
if (context.Request.Method == "OPTIONS")
|