-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
107 lines (104 loc) · 3.03 KB
/
Copy pathnext.config.ts
File metadata and controls
107 lines (104 loc) · 3.03 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import type { NextConfig } from "next";
/**
* Static fallback CSP — enforced on every response via Next.js headers().
*
* The dynamic nonce-based CSP in src/proxy.ts overrides this for page routes,
* but static assets (/_next/static/*), error pages, and any request the proxy
* doesn't intercept still need baseline protection.
*
* Without nonces, we use 'strict-dynamic' + 'unsafe-inline' as a fallback pair:
* browsers that support strict-dynamic ignore unsafe-inline (CSP3 spec §8.1),
* while older browsers fall back to unsafe-inline rather than blocking everything.
*/
const fallbackCsp = [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'strict-dynamic'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https://i.scdn.co https://i.ytimg.com https://images.genius.com",
"font-src 'self' https://fonts.gstatic.com",
"connect-src 'self' https://api.spotify.com https://accounts.spotify.com https://www.googleapis.com https://api.genius.com",
"media-src 'self' https://p.scdn.co",
"frame-src 'none'",
"object-src 'none'",
"base-uri 'self'",
"form-action 'self'",
"upgrade-insecure-requests",
].join("; ");
const nextConfig: NextConfig = {
env: {
NEXT_PUBLIC_APP_VERSION: process.env.npm_package_version ?? "0.0.0",
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "i.scdn.co",
pathname: "/image/**",
},
{
protocol: "https",
hostname: "i.ytimg.com",
pathname: "/**",
},
{
protocol: "https",
hostname: "images.genius.com",
pathname: "/**",
},
],
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: fallbackCsp,
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=(), payment=(), usb=(), bluetooth=(), serial=(), hid=(), idle-detection=(), screen-wake-lock=(), web-share=(self)",
},
{
key: "X-DNS-Prefetch-Control",
value: "off",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
{
key: "X-Permitted-Cross-Domain-Policies",
value: "none",
},
{
key: "Cross-Origin-Resource-Policy",
value: "same-origin",
},
{
key: "Cross-Origin-Embedder-Policy",
value: "credentialless",
},
],
},
];
},
};
export default nextConfig;