Adding headers to all error pages

ltning-nginx at anduin.net ltning-nginx at anduin.net
Tue Nov 17 11:13:08 UTC 2026


Hi,

we're largely relying on the internal error pages in nginx, with a few 
exceptions where we serve static HTML files. Lately it has been required 
of us to include the response header
     X-Content-Type-Options: nosniff
in every response - including all possible error pages.

As this is floated by a PCI ASV (a network scanning company "certified" 
by the payment industry, to whom we pay protection money to be allowed 
to continue doing what we do), I'm having a hard time pointing out how 
absolutely ludicrous this is: It would require a *lot* of changes to our 
configurations, introducing risks and pitfalls where there currently are 
none.

Is there a way to relatively easily do this, without constructing new 
location { } blocks handling all the errors we expect to encounter?

I've been arguing that there are good reasons to not add a lot of 
headers to error responses, and for pages that are strictly plain HTML, 
this particular header makes absolutely no sense. Sadly, I do not expect 
to make much headway.

Thanks,
/Eirik


More information about the nginx mailing list