Closed tinleym closed 2 years ago
There's a simple fix for this. Using the example above, just put this in your _document:
<Head>
<meta
httpEquiv="Strict-Transport-Security"
content={"max-age=63072000; includeSubDomains; preload"}
/>
</Head>
I'm getting errors when trying to use next-safe-config-middleware with headers in next.config.js.
For example, the following configuration...
... yields the following error:
source
is missing,headers
field must be an array, invalid fields: key,value for route {"key":"Strict-Transport-Security","value":"max-age=63072000; includeSubDomains; preload"}I see that the docs recommend using next-safe to add additional headers. However, there are many headers (like the one above) that next-safe doesn't cover.
How should one add an arbitrary header with next-safe-middleware?