CORS Policy not working and accepting all domain
# help-with-umbraco
n
n
@Nilay I'm on my phone right now but it looks like that you didn't specify the same name in the UHeadless cors settings as where you registered it?
n
i tried with same name MyAllowSpecificOrigins and also different name but for any case it was allowing all domains @User
@Nikcio any suggestion ?
n
Are you sending the
Origin
header on your request? Otherwise Asp Net Core dont apply any cors policies. As far as I can tell I only register the cors the default way for the GrapgQL endpoint: https://github.com/nikcio/Nikcio.UHeadless/blob/v4%2Fcontrib/src%2FNikcio.UHeadless%2FExtensions%2FUHeadlessExtensions.cs#L135
If that doesnt work you can also try adding .MapGraphQL directly giving you access to the endpoint builder I believe. And then add .RequireCors("YourPolicyName") https://github.com/nikcio/Nikcio.UHeadless/blob/v4%2Fcontrib/src%2FNikcio.UHeadless%2FExtensions%2FUHeadlessExtensions.cs#L142
n
Thanks. I will check it out
48 Views