From 80b3be48eae45899354c5407dd03b16cfae04a50 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Oct 2026 17:15:12 -0400 Subject: [PATCH] Stop next/image from 400-ing every SVG in the site The logo, the burger button and the social icons are SVGs, and the image optimizer refuses SVG by default, so each of those requests answered 400 and the images silently never appeared. Allow SVG on the optimiser together with the restrictive CSP the image endpoint then requires (script-src 'none'; sandbox), so an SVG served from _next/image cannot carry script. Verified: all three paths now return 200 with that CSP on the response. --- next.config.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/next.config.mjs b/next.config.mjs index 715ae63..29f964a 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -8,6 +8,12 @@ const nextConfig = { poweredByHeader: false, turbopack: {}, images: { + // The logo, the burger button and the social icons are SVGs. Without this + // flag next/image refuses to optimise them and answers 400, so every SVG + // in the site silently fails to load. Serving them from the optimiser needs + // a restrictive CSP on the image endpoint, because an SVG can carry script. + dangerouslyAllowSVG: true, + contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;", remotePatterns: [ { protocol: 'https',