Skip to content

Commit 581db9c

Browse files
Slashgearclaude
andcommitted
perf: remove nonce-based CSP, switch to static CSP headers
Remove await headers() from root layout that was forcing all pages into dynamic rendering. Move CSP to static headers in next.config.ts (nonce not needed since the only inline script is application/ld+json). Delete proxy.ts (dead code). This re-enables static generation and ISR across the entire site. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 462a220 commit 581db9c

3 files changed

Lines changed: 19 additions & 69 deletions

File tree

app/layout.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
import { Metadata, Viewport } from 'next';
22
import React, { ReactNode } from 'react';
3-
import { headers } from 'next/headers';
43
import { Header } from '../modules/header/Header';
54
import { Footer } from '../modules/footer/Footer';
65

76
import 'normalize.css';
87
import '../styles/globals.css';
98
import { ORGANISATION_MARKUP } from './org-markup';
109

11-
export default async function AppLayout({ children }: { children: ReactNode }) {
12-
const header = await headers();
13-
const nonce = header.get('x-nonce');
14-
10+
export default function AppLayout({ children }: { children: ReactNode }) {
1511
return (
1612
<html lang="fr-FR">
1713
<body>
1814
<div id="__next">
1915
<Header />
2016
<script
2117
type="application/ld+json"
22-
nonce={`${nonce}`}
2318
dangerouslySetInnerHTML={{
2419
__html: JSON.stringify(ORGANISATION_MARKUP),
2520
}}

next.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ const nextConfig: NextConfig = {
6868
key: 'Permissions-Policy',
6969
value: 'camera=(), microphone=(), geolocation=(), browsing-topics=()',
7070
},
71+
{
72+
key: 'Content-Security-Policy',
73+
value: [
74+
"default-src 'none'",
75+
"script-src 'self'",
76+
"img-src 'self' https://secure-content.meetupstatic.com/ https://images.ctfassets.net/ https://assets.vercel.com/ https://secure.meetupstatic.com/ https://img.youtube.com/",
77+
"style-src 'self' 'unsafe-inline'",
78+
'frame-src https://www.youtube.com/',
79+
"manifest-src 'self'",
80+
"object-src 'none'",
81+
"form-action 'none'",
82+
"connect-src 'self'",
83+
"font-src 'self'",
84+
"base-uri 'self'",
85+
"frame-ancestors 'none'",
86+
'upgrade-insecure-requests',
87+
].join('; '),
88+
},
7189
],
7290
},
7391
];

proxy.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)