hutongqing
2024-10-25 9eeca6aa905cffea1c95d965b4790fbd20ce2275
WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/CorsSetup.cs
@@ -24,14 +24,14 @@
            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();
                        });
@@ -39,7 +39,7 @@
                else
                {
                    //允许任意跨域请求
                    c.AddPolicy(AppSettings.app(new string[] { "Cors", "PolicyName" }),
                    c.AddPolicy(AppSettings.Get(new string[] { "Cors", "PolicyName" }),
                        policy =>
                        {
                            policy