Have you wondered what info you are leaking via your response headers?, do you want some kind of guide about what headers to set or remove altogether?

Head on over to https://securityheaders.com/ This is a site created by security expert Scott Helme that rates a URL based on what response headers it can see.

I am pleased to say www.funkysi1701.com is now getting an A.Alt Text

So how do you add/remove headers in dotnet core?

In my configure method in Startup.cs I have the following code block.

    next =>
        return async context =>
                () =>
                    context.Response.Headers.Add("Permissions-Policy", "microphone=()");     
                    return Task.CompletedTask;

             await next(context);

I have only included a few of the headers I am adding as the excellent https://securityheaders.com/ can tell you which headers you should add and what options you might want.

This post is also available on DEV.