in asp.net core i can use middleware to enable CORS on certain methods as described here
i want to know if its possible to enable CORS for any scheme and any port on localhost
( for testing purpose only). i tried wildcard and it does not work
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
if(_environment.IsDevelopment())
{
options.AddDefaultPolicy(
builder =>
{
builder.WithOrigins("http://localhost/*",
"https://localhost/*");
});
});
}
else
{
options.AddDefaultPolicy(
builder =>
{
builder.WithOrigins("http://example.com",
"http://www.contoso.com");
});
});
}
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}