Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About CORS errors #37

Closed
JoaoOxOc opened this issue Apr 5, 2020 · 2 comments
Closed

About CORS errors #37

JoaoOxOc opened this issue Apr 5, 2020 · 2 comments
Labels
wontfix This will not be worked on

Comments

@JoaoOxOc
Copy link

JoaoOxOc commented Apr 5, 2020

Hi,

I just checked that the demo of this project has CORS error.

I think you can solve them by applying the actual array of permitted URL'S:
1 - get the list of URL's from appsettings:
string[] corsUrl = configuration.GetSection("ApplicationSettings:Cors").Get<string[]>();

2 - Load the array on startup:

services.AddCors(options =>
            {
                options.AddPolicy("Default",
                    builder => builder.AllowAnyOrigin()
                        .WithOrigins(corsUrl)
                        .SetIsOriginAllowed((host) => true)
                        .AllowAnyMethod()
                        .AllowAnyHeader());
            });
@stale
Copy link

stale bot commented Jun 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 4, 2020
@stale stale bot closed this as completed Jun 11, 2020
@louiseJing
Copy link

@JoaoOxOc I add the code segment to the project. But when I published in IIS,brower the Web.the CORS error already exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants