I am facing a issue when Identity server redirect from https:/sso.com/connect/authorize?.. to https://anotherhost.com/sigin-oidc it is showing CSP error as stated that
refused to send form data to form-action 'https://anotherhost.com/sigin-oidc' because it violets the following content security policy directive : form-action https://anotherhost.com
Currently till now i have found that Google & Safari browser is not allow form action even in Get Request if it not properly defined CSP mean i have to added https://anotherhost.com/sigin-oidc in CSP but my main issue is that how would i add in Asp.net core because when i am trying to added like below
app.Use(async (context, next) =>
{
if (context.Request.Path.StartsWithSegments("/connect/authorize"))
{
context.Response.Headers.["Content-Security-Policy"] += "form-action 'self' https://anotherhost.com/sigin-oidc";
}
await next();
});
this code only adding form-action rest of policy are missing. so I have two question , first is how connect/authorize internally add this content security policy & second how can i manage in asp.net core .
<meta>tags in your page to set allowed origin $\endgroup$"script-src 'self' 'unsafe-inline';". Maybe you can try. app.Use(async (context, next) => { context.Response.Headers.Add("Content-Security-Policy", "form-action 'self';" + "script-src 'self' 'unsafe-inline';" + "style-src 'self' 'unsafe-inline';" + "upgrade-insecure-requests; "); await next(); }); $\endgroup$