Hi RomKo,
Thank you for reaching out to Microsoft Q & A forum.
Thank you for bringing the issue to our attention. The error message "cors missing allow origin" signals a problem with the Cross-Origin Resource Sharing (CORS) setup in our application. CORS serves as a security measure enforced by web browsers to regulate cross-origin HTTP requests.
Upon investigation, it appears that the CORS policy was not correctly applied, leading to the absence of necessary CORS headers in the response. The issue stems from the inclusion of "" (wildcard) as an allowed origin in the CORS policy. Allowing "" permits requests from any origin, potentially exposing security vulnerabilities and causing errors.
To rectify this, we've adjusted the CORS policy to explicitly define the origins from which we permit requests, such as "[http://example.com]" and "[http://localhost:3000]". This ensures that only requests from these trusted origins are accepted, bolstering the security of our application.
builder.Services.AddCors(options =>
{
options.AddPolicy(name: MyAllowSpecificOrigins,
builder =>
{
builder.WithOrigins(
"http://example.com",
"http://localhost:3000"
)
.AllowAnyHeader()
.AllowAnyMethod();
});
});
This adjustment should properly enforce the CORS policy, ensuring that the necessary CORS headers, like Access-Control-Allow-Origin, are included in the response. Consequently, this will resolve the "cors missing allow origin" error and restore the proper functionality of our application.
If you have any further questions or concerns, please don't hesitate to reach out. We're here to assist you further.
If you've found the provided answer helpful, please click the "Accept Answer/Upvote" button. This will be beneficial to other members of the Microsoft Q&A forum community.
Thank you.