| | |
| | | |
| | | services.AddCors(c => |
| | | { |
| | | if (!AppSettings.app(new string[] { "Cors", "EnableAllIPs" }).ObjToBool()) |
| | | if (!AppSettings.Get(new string[] { "Cors", "EnableAllIPs" }).ObjToBool()) |
| | | { |
| | | c.AddPolicy(AppSettings.app(new string[] {"Cors", "PolicyName" }), |
| | | c.AddPolicy(AppSettings.Get(new string[] {"Cors", "PolicyName" }), |
| | | |
| | | policy => |
| | | { |
| | | policy |
| | | .WithOrigins(AppSettings.app(new string[] { "Cors", "IPs" }).Split(',')) |
| | | .WithOrigins(AppSettings.Get(new string[] { "Cors", "IPs" }).Split(',')) |
| | | .AllowAnyHeader()//Ensures that the policy allows any header. |
| | | .AllowAnyMethod(); |
| | | }); |
| | |
| | | else |
| | | { |
| | | //鍏佽浠绘剰璺ㄥ煙璇锋眰 |
| | | c.AddPolicy(AppSettings.app(new string[] { "Cors", "PolicyName" }), |
| | | c.AddPolicy(AppSettings.Get(new string[] { "Cors", "PolicyName" }), |
| | | policy => |
| | | { |
| | | policy |