Skip to content

Commit 7c407a1

Browse files
committed
CSP - code added
1 parent 91e17a7 commit 7c407a1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

WebAPI/LearningHub.Nhs.API/Program.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@
3838

3939
app.UseMiddleware<ExceptionMiddleware>();
4040

41-
////app.Use(async (context, next) =>
42-
////{
43-
//// ////context.Response.Headers.Add("content-security-policy", "object-src 'none'; frame-ancestors 'none'; sandbox allow-forms allow-same-origin allow-scripts allow-popups; base-uri 'self';");
44-
//// context.Response.Headers.Add("Referrer-Policy", "no-referrer");
45-
//// context.Response.Headers.Add("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
46-
//// context.Response.Headers.Add("X-Content-Type-Options", "nosniff");
47-
//// context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
48-
//// context.Response.Headers.Add("X-XSS-protection", "0");
49-
//// await next();
50-
////});
41+
app.Use(async (context, next) =>
42+
{
43+
context.Response.Headers.Add("content-security-policy", "object-src 'none'; frame-ancestors 'none'; sandbox allow-forms allow-same-origin allow-scripts allow-popups; base-uri 'self';");
44+
context.Response.Headers.Add("Referrer-Policy", "no-referrer");
45+
context.Response.Headers.Add("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
46+
context.Response.Headers.Add("X-Content-Type-Options", "nosniff");
47+
context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
48+
context.Response.Headers.Add("X-XSS-protection", "0");
49+
await next();
50+
});
5151

5252
app.UseEndpoints(endpoints => endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"));
5353

0 commit comments

Comments
 (0)