Closed sps014 closed 3 years ago
Inside of UseRouting
the CORS middleware looks for CORS enabling metadata on an endpoint to determine if it needs to respond. In an MVC action, this is enabled by the presence of the EnableCorsAttribute
. In a minimal action, you'd have to use RequireCors
to enable it. Alternatively, you could configure the middleware before the call to UseRouting
which should enable it for all requests indiscriminately.
Is there a sample available also Can we expect documentation on same in future? Thanks
Something like this would work:
app.MapGet("/",()=> "(running)").RequireCors("_myAllowSpecificOrigins");
Can we expect documentation on same in future?
Yes, we're a bit behind on the docs while we're working on landing the minimal API feature work, but we do plan to get this resolved soon.
Thanks for quick response
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.
See our Issue Management Policies for more information.
On Dotnet 6 preview 6, CORS Middleware in Minimal API does not work even with correct configuration , keeps throwing CORS error on client side.
Here is my code