secure headers

This commit is contained in:
xhyrom 2022-01-02 19:01:45 +01:00
parent 1044d2ddc2
commit 65b7c2f4c2
3 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,14 @@
const { createSecureHeaders } = require("next-secure-headers");
module.exports = { module.exports = {
assetPrefix: '/roles-bot/' assetPrefix: '/roles-bot/',
async headers() {
return [{
source: "/(.*)",
headers: createSecureHeaders({
forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }],
referrerPolicy: "same-origin",
}),
}];
},
} }

View file

@ -7,6 +7,7 @@
"name": "web", "name": "web",
"dependencies": { "dependencies": {
"next": "12.0.7", "next": "12.0.7",
"next-secure-headers": "^2.2.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2" "react-dom": "17.0.2"
}, },
@ -4064,6 +4065,14 @@
} }
} }
}, },
"node_modules/next-secure-headers": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/next-secure-headers/-/next-secure-headers-2.2.0.tgz",
"integrity": "sha512-C7OfZ9JdSJyYMz2ZBMI/WwNbt0qNjlFWX9afUp8nEUzbz6ez3JbeopdyxSZJZJAzVLIAfyk6n73rFpd4e22jRg==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/node-fetch": { "node_modules/node-fetch": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
@ -8405,6 +8414,11 @@
"watchpack": "2.3.0" "watchpack": "2.3.0"
} }
}, },
"next-secure-headers": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/next-secure-headers/-/next-secure-headers-2.2.0.tgz",
"integrity": "sha512-C7OfZ9JdSJyYMz2ZBMI/WwNbt0qNjlFWX9afUp8nEUzbz6ez3JbeopdyxSZJZJAzVLIAfyk6n73rFpd4e22jRg=="
},
"node-fetch": { "node-fetch": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",

View file

@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"next": "12.0.7", "next": "12.0.7",
"next-secure-headers": "^2.2.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2" "react-dom": "17.0.2"
}, },