Skip to content

Commit 69203f0

Browse files
PJCoopsclaude
andcommitted
security: Add HTTP security headers
Add protective headers to prevent common attacks: - X-Frame-Options: SAMEORIGIN (clickjacking) - X-Content-Type-Options: nosniff (MIME sniffing) - Referrer-Policy: strict-origin-when-cross-origin - Permissions-Policy: disable camera/mic/geo - X-XSS-Protection: legacy XSS filter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 692676e commit 69203f0

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

next.config.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
4+
async headers() {
5+
return [
6+
{
7+
source: "/(.*)",
8+
headers: [
9+
{
10+
key: "X-DNS-Prefetch-Control",
11+
value: "on",
12+
},
13+
{
14+
key: "X-Frame-Options",
15+
value: "SAMEORIGIN",
16+
},
17+
{
18+
key: "X-Content-Type-Options",
19+
value: "nosniff",
20+
},
21+
{
22+
key: "Referrer-Policy",
23+
value: "strict-origin-when-cross-origin",
24+
},
25+
{
26+
key: "Permissions-Policy",
27+
value:
28+
"camera=(), microphone=(), geolocation=(), interest-cohort=()",
29+
},
30+
{
31+
key: "X-XSS-Protection",
32+
value: "1; mode=block",
33+
},
34+
],
35+
},
36+
];
37+
},
538
};
639

740
export default nextConfig;

0 commit comments

Comments
 (0)