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.
This commit is contained in:
root committed 2026-10-01 17:15:12 -04:00
1 parent 6a56b27b01
commit 80b3be48ea
1 file changed
+6
+6
View File
@@ -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',