Custom Cors Policy Service not being invoked #214
Unanswered
sanjeev-saxena-us
asked this question in
IdentityServer
Replies: 1 comment
-
Hey @sanjeev-saxena-us, what you have should work. I verified it triggers the CORS policy, but you need to issue the request from a JavaScript client from a different origin. Follow these instructions. Create a new Vite application (or JavaScript app). npm create vite@latest cors-tester -- --template vanilla then in var response = await fetch('https://localhost:5001/.well-known/openid-configuration'); In your IdentityServer instance, you should see that the builder.Services.AddTransient<ICorsPolicyService>((container) =>
{
var logger = container.GetRequiredService<ILogger<DefaultCorsPolicyService>>();
logger.LogInformation("Creating CORS policy service");
return new DefaultCorsPolicyService(logger)
{
AllowAll = true
};
}); And here is the output in my logs. Your HTTP request requires that the initial request set the Hope this helps, Khalid Abuhakmeh |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment:
.net8
Duende.IdentityServer 7.2.3
It appears that registering a custom CORS policy service is not being invoked; things I've tried (including what has been documented here):
Followed by:
Including/excluding the .AddCorsPolicyService() makes no difference.
I do not see any logs from the 1st CustomPolicyService.
In the 2nd option, have also have a breakpoint at the line
return new DefaultCorsPolicyService(logger)...
which never gets hit.This is blocking me from moving forward (Browser based Edge, Chrome, FF makes no difference). Not using Postman.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions