跨域配置调整

usertest
zhangxiaofeng 4 months ago
parent db8e8a39cd
commit 56f88de569

@ -31,8 +31,12 @@ public static class CorsInstall
policy.WithOrigins(corsUrl
.Split(",", StringSplitOptions.RemoveEmptyEntries).ToArray())
//policy.WithOrigins("http://localhost:5001")//支持多个域名端口,注意端口号后不要带/斜杆比如localhost:8000/,是错的
.AllowAnyHeader().AllowAnyMethod().AllowCredentials()
.WithExposedHeaders(exposedHeaders.Split(",", StringSplitOptions.RemoveEmptyEntries)); //允许cookie;
.AllowAnyHeader().AllowAnyMethod().AllowCredentials();
if (!string.IsNullOrEmpty(exposedHeaders))
{
policy.WithExposedHeaders(exposedHeaders.Split(",", StringSplitOptions.RemoveEmptyEntries)); //允许cookie;
}
});
});

Loading…
Cancel
Save