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

The OrchardCore.Cors module seems to be broken. #15485

Closed
hyzx86 opened this issue Mar 11, 2024 · 8 comments
Closed

The OrchardCore.Cors module seems to be broken. #15485

hyzx86 opened this issue Mar 11, 2024 · 8 comments

Comments

@hyzx86
Copy link
Contributor

hyzx86 commented Mar 11, 2024

The OrchardCore.Cors module seems to be broken.
After adding the following code in Program.cs, the cross-domain access works fine

builder.Services.AddCors(options =>
{
    options.AddDefaultPolicy(builder =>
    {
        builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
    });
});
....
app.UseCors();
@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 11, 2024

relate :#15416 (comment)

@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 11, 2024

I remember this was a problem a year ago, but it was fixed, and now it's back

@hishamco
Copy link
Member

Could you please submit a PR?

I remembered there was a PR related to CORS, I'm not sure if it's the main reason for this issue

@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 11, 2024

Could you please submit a PR?

I remembered there was a PR related to CORS, I'm not sure if it's the main reason for this issue

Sorry, it was hardcoded in my 'Program.cs' file and I haven't found the real reason yet.
Probably because of the order in which modules are loaded.

@hishamco
Copy link
Member

I'm not sure if it's related to #15486, @hyzx86 could you please write the steps to reproduce, I might investigate on this

@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 11, 2024

I'm not sure if it's related to #15486, @hyzx86 could you please write the steps to reproduce, I might investigate on this

I'm trying to locate the problem,
Initially I got the package from Nuget and found that the cross-origin feature wasn't working,
Then I packaged from the source code locally and replaced the dll file in my native solution, the problem still existed.
I noticed that your code seems to be tweaking the packing process, so this issue is probably not related to the bundling process

@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 11, 2024

Using the following recipe test, it turns out that this problem does not exist in the OC source code, the problem may be in my custom code, I need to check where is incompatible with the existing code.

Here is my recipe
Recipe.json

@hyzx86 hyzx86 closed this as completed Mar 11, 2024
@hishamco
Copy link
Member

Happy to hear that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants