From e7050e135dd46193e83505355d13f893603234be Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Mon, 26 Aug 2024 22:53:47 +0200 Subject: [PATCH] feat(site): add security headers --- server/middleware/{cache-control.js => headers.js} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename server/middleware/{cache-control.js => headers.js} (64%) diff --git a/server/middleware/cache-control.js b/server/middleware/headers.js similarity index 64% rename from server/middleware/cache-control.js rename to server/middleware/headers.js index e3e4ca824a2..15b87d8e6db 100644 --- a/server/middleware/cache-control.js +++ b/server/middleware/headers.js @@ -1,8 +1,9 @@ -import { useCDNHeaders } from '#nuxt-multi-cache/composables' - export default defineEventHandler((event) => { const url = event.node.req.url; + event.node.res.setHeader("X-Frame-Options", "DENY"); + event.node.res.setHeader("X-Content-Type-Options", "nosniff"); + if (url.startsWith("/api/_content/")) { event.node.res.setHeader("Cache-Control", "public, max-age=604800, immutable"); }