Skip to content

Commit

Permalink
Merge pull request #140 from ministryofjustice/hotfix/secure-cookies
Browse files Browse the repository at this point in the history
force https
  • Loading branch information
yqi88i authored Aug 15, 2024
2 parents c7589ec + eabde67 commit 0e4f2bb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Server.UI/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ public static WebApplication ConfigureServer(this WebApplication app, IConfigura
app.UseAuthentication();
app.UseAuthorization();


app.Use((context, next) =>
{
context.Request.Scheme = "https";
return next();
});

app.Use(async (context, next) =>
{
context.Response.Headers.Append("Content-Security-Policy", "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; object-src 'self' data:; frame-src 'self' data:;");
Expand Down

0 comments on commit 0e4f2bb

Please sign in to comment.