Custom Headers for 404 Responses?

I would like to modify the response headers for 404 pages. Specifically, to change the content-type of the 404 to “application/json”.

Here’s the regular, 200-served content: https://afoot-lists.netlify.app/phonetic

I would like the 404 to follow suit: https://afoot-lists.netlify.app/fourohhour , but it serves text/html no matter what config I try. Is this even possible to configure?

From my netlify.toml file:

[[headers]]
  for = "/lists/*"
  [headers.values]
    content-type = "application/json"
    Access-Control-Allow-Origin= "*"

[[redirects]]
  from = "/:endpoint"
  to = "/lists/:endpoint.json"
  status = 200

Hi, welcome back to the forums!

Have you tried using a Serverless Function? You can set the desired response headers and return a JSON response with the appropriate status code?

Thanks, that’s a creative idea. Hoped for something simpler, but that might work.