C
C#2y ago
abc

❔ CORS error

I have enabled cors according to: https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-7.0 named policy and middleware policy.WithOrigins("http://localhost:7022").AllowAnyHeader().AllowAnyMethod(); i still get rom origin 'https://localhost:7022' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Enable Cross-Origin Requests (CORS) in ASP.NET Core
Learn how CORS as a standard for allowing or rejecting cross-origin requests in an ASP.NET Core app.
3 Replies
jcotton42
jcotton422y ago
http vs https
Two URLs have the same origin if they have identical schemes, hosts, and ports (RFC 6454). These two URLs have the same origin: https://example.com/foo.html https://example.com/bar.html These URLs have different origins than the previous two URLs: https://example.net: Different domain https://www.example.com/foo.html: Different subdomain http://example.com/foo.html: Different scheme https://example.com:9000/foo.html: Different port
Cracker
Cracker2y ago
browser also checks for CORS even if you enabled in backend, so if you use like Angular for frontend, you might also need add some headers to request
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server