options.AddPolicy("AllowAll",
builder => builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials())
This code is showing a CORS error:
The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the CORS policy by listing individual origins if credentials needs to be supported.
How can I solve this? How can I add a wildcard origin with AllowCredentials
?
You couldn't do that
as mentioned in the document:
and this part in the document:
for example: Access-Control-Allow-Origin: https://example.com
for example, Access-Control-Allow-Methods: POST, GET
for example, Access-Control-Expose-Headers: Content-Encoding, Kuma-Revision
If you set with
WithOrigins("*")
it would addAccess-Control-Allow-Origin:*
to the response header