-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
46 lines (42 loc) · 1.6 KB
/
Copy pathnext.config.ts
File metadata and controls
46 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import type { NextConfig } from "next";
const contentSecurityPolicy = [
"default-src 'self'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
"object-src 'none'",
"script-src 'self' 'unsafe-inline'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https://*.supabase.co",
// The approved motion proof is an MP4 served from a private Supabase bucket via a
// signed URL. Without an explicit media-src it inherits default-src 'self', so the
// browser blocks the video while images continue to load through img-src, which
// renders as a black player stuck at 0:00.
"media-src 'self' blob: https://*.supabase.co",
"connect-src 'self' https://*.supabase.co wss://*.supabase.co",
"font-src 'self'",
"manifest-src 'self'",
"upgrade-insecure-requests",
].join("; ");
const securityHeaders = [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Referrer-Policy", value: "no-referrer" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" },
{ key: "Cross-Origin-Resource-Policy", value: "same-origin" },
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
...(process.env.NODE_ENV === "production"
? [{ key: "Content-Security-Policy", value: contentSecurityPolicy }]
: []),
];
const nextConfig: NextConfig = {
poweredByHeader: false,
async headers() {
return [{ source: "/(.*)", headers: securityHeaders }];
},
};
export default nextConfig;