headers duplicated issue
Hello, nuxt generate these headers:
x-content-type-options: nosniff
X-Content-Type-Options: nosniff
And then I got these headers. some browsers are not happy with that. there's a way to fix that ? Thanks!
same issue for strict hsts. cloudflare generate wrong header then



4 Replies
Hi @GreyXor. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Nuxt itself does not provide built-in configuration to deduplicate or merge HTTP headers like
X-Content-Type-Options
or Strict-Transport-Security
if they are set multiple times (e.g., once by Nuxt and once by a CDN or proxy like Cloudflare). This can result in duplicated headers with different casing, which may cause issues in some browsers.
From the available knowledge sources, there is a related fix in Nuxt for deduplicating certain arrays in app.head
(such as meta tags), but this does not apply to HTTP response headers—only to HTML head elements like <meta>
or <link>
tags in the rendered HTML, not to server response headers themselves fix(nuxt): deduplicate app.head arrays.
For HTTP headers, deduplication typically needs to be handled at the server or CDN/proxy level (e.g., in your Cloudflare or Nginx configuration), not within Nuxt itself. If Cloudflare or your server is adding headers that Nuxt is also setting, you should adjust your server or CDN configuration to avoid setting the same header twice.
I'm sorry, but the knowledge sources do not contain explicit information about deduplicating HTTP response headers in Nuxt or a direct Nuxt configuration to resolve this issue. You may need to review your server/CDN settings to ensure headers are only set once.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@571436665738887226> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
What would be introducing duplicates... do you have other libraries in use?
It's the way cloudflare work
nuxt generate this _headers:
/foo
bar=1
/*
bar=1
and then cloudflare for /foo. add these two header.
bar=1, 1