Remove x-powered-by header (#211) (#224)

This commit is contained in:
Marcel Rengers 2022-09-11 02:34:29 +02:00 committed by GitHub
parent 686a1c1b6a
commit e5d0eb047c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -29,7 +29,8 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.3.0", "react-router-dom": "^6.3.0",
"serialize-javascript": "^6.0.0" "serialize-javascript": "^6.0.0",
"helmet": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.19.0", "@babel/core": "^7.19.0",

View File

@ -32,6 +32,7 @@ const jsScriptTagsFromAssets = (assets, entrypoint, extra = '') => {
const theme = runtimeConfig.THEME === 'Dark' ? 'dark.css' : 'light.css'; const theme = runtimeConfig.THEME === 'Dark' ? 'dark.css' : 'light.css';
const helmet = require('helmet');
const server = express(); const server = express();
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
@ -55,7 +56,7 @@ if (process.env.NODE_ENV === 'production') {
} }
server server
.disable('x-powered-by') .use(helmet.hidePoweredBy())
.use(express.static(process.env.RAZZLE_PUBLIC_DIR)) .use(express.static(process.env.RAZZLE_PUBLIC_DIR))
.get('/', (req, res) => { .get('/', (req, res) => {
const context = {}; const context = {};

View File

@ -4600,6 +4600,11 @@ he@^1.2.0:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
helmet@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/helmet/-/helmet-6.0.0.tgz#8e183820ddccd7729a206ad73c577b264f495595"
integrity sha512-FO9RpR1wNJepH/GbLPQVtkE2eESglXL641p7SdyoT4LngHFJcZheHMoyUcjCZF4qpuMMO1u5q6RK0l9Ux8JBcg==
hex-color-regex@^1.1.0: hex-color-regex@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"