Reputation: 10723
This is in C#:
services.AddCors(o => o.AddPolicy("AllowMyPolicy", builder =>
{
builder.WithOrigins(new string[] { "https://*.mySite.com", "https://localhost:*" })
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()
.SetIsOriginAllowedToAllowWildcardSubdomains();
}));
And it works for my live site. But when I try to access it from https://localhost:44302/ it doesn't work. What am I missing? I would like fr the port to be generic, not a specific number.
Upvotes: 0
Views: 571
Reputation: 14191
You cannot use CORS to enable a host on any port. You need to explicitly add an entry for each port.
builder.WithOrigins(new string[] { "https://*.mySite.com", "https://localhost:44302" })
Upvotes: 4