Commit 03fc9085 authored by 黄奎's avatar 黄奎

跨域配置调整

parent fbc12c07
...@@ -58,34 +58,13 @@ namespace Mall.WebApi ...@@ -58,34 +58,13 @@ namespace Mall.WebApi
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
options.JsonSerializerOptions.PropertyNamingPolicy = null; options.JsonSerializerOptions.PropertyNamingPolicy = null;
}); });
List<string> corsArray = new List<string>() List<string> corsArray = new List<string>();
string corsUrlStr = Common.Config.ReadConfigKey("corsUrl");
foreach (var item in corsUrlStr.Split(','))
{ {
"http://localhost:8081", corsArray.Add(item);
"http://127.0.0.1:8081", }
"http://127.0.0.1:8085",
"http://localhost:8181",
"http://localhost:8080",
"http://127.0.0.1:8080",
"http://localhost:8082",
"http://127.0.0.1:8082",
"http://localhost:8083",
"http://127.0.0.1:8083",
"http://127.0.0.1:50512",
"http://127.0.0.1:20224",
"http://127.0.0.1:28221",
"http://www.test.com:8080",
"http://www.test.com:8081",
"http://yx.oytour.com",
"http://mall.oytour.com",
"http://testmall.oytour.com",
"http://yx.oytour.com",
"https://mallapi.oytour.com",
"http://edu.oytour.com",
"http://jvs.oytour.com",
"http://pic.oytour.com",
"http://admin.jjsw.vip",
"http://mallweb.jjsw.vip",
};
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray()))); services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
......
...@@ -122,5 +122,6 @@ ...@@ -122,5 +122,6 @@
"accessKeyId": "LTAI5tFgqt1pwnoA35cigYTr", "accessKeyId": "LTAI5tFgqt1pwnoA35cigYTr",
"accessKeySecret": "wXPoEqJ7qLdvX9iBluIebhCPSzoemy", "accessKeySecret": "wXPoEqJ7qLdvX9iBluIebhCPSzoemy",
"domain": "https://vt-im-bucket.oss-cn-chengdu.aliyuncs.com" "domain": "https://vt-im-bucket.oss-cn-chengdu.aliyuncs.com"
} },
"corsUrl": "http://localhost:8081,http://127.0.0.1:8081,http://127.0.0.1:8085,http://localhost:8181,http://localhost:8080,http://127.0.0.1:8080,http://localhost:8082,http://127.0.0.1:8082,http://localhost:8083,http://127.0.0.1:8083,http://127.0.0.1:50512,http://127.0.0.1:20224,http://127.0.0.1:28221,http://www.test.com:8080,http://www.test.com:8081,http://yx.oytour.com,http://mall.oytour.com,http://testmall.oytour.com,http://yx.oytour.com,https://mallapi.oytour.com,http://edu.oytour.com,http://jvs.oytour.com,http://pic.oytour.com,http://admin.jjsw.vip,http://mallweb.jjsw.vip,http://admin.oytour.com"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment