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