Why can I send request with all URLs to my API project, however inside my Program.cs I set only two specific URLs as allowed origins.
builder.Services.AddCors(options =>
{
options.AddPolicy(name: "policyName", builder =>
{
builder.WithOrigins(
"http://sitehere.com",
"http://TheOtherSiteHere.com"
);
});
});
app.UseRouting();
app.UseCors("policyName");
In all of my controllers I have the [EnableCors("policyName")]
's attribute as well.
But in postman, with my local IP address or another computer's ip address which is in the same local network, all requests will be accepted.
In my case, I want to prevent all requests, except "http://sitehere.com"
and "http://TheOtherSiteHere.com"