Skip to content

CORS - AnyOrigin & WithOrigins has no effect #63120

@KevinKrueger

Description

@KevinKrueger

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

ConfigureServices:

        services.AddCors(options =>
        {
            options.AddPolicy("CorsPolicy",
               builder => builder
                    .WithOrigins("http://192.168.3.9:8080")
                    .AllowAnyMethod()
                    .AllowAnyHeader());
        });

Configure:

        app.UseRouting();
        app.UseCors("CorsPolicy");

Result:
Image

I also had the effect for a short time although it didn't work before, but then it suddenly worked.

I deleted the bin and obj folders and recompiled them..no effect

Expected Behavior

That it works.

Steps To Reproduce

  • Create an separated api and blazor wasm client in .net 9
  • Create an endpoint and connect to this on client side

Exceptions (if any)

No response

.NET Version

.net 9

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-corsThis issue is related to CORS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions