Repository navigation
Expand file tree
/
Copy pathnext.config.mjs
More file actions
154 lines (152 loc) · 5.37 KB
/
Copy pathnext.config.mjs
File metadata and controls
154 lines (152 loc) · 5.37 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
const phase172Enabled = ["1", "true", "yes", "on"].includes(
(process.env.NEXT_PUBLIC_FEATURE_PHASE_172 ?? "").trim().toLowerCase(),
)
const phase171Enabled = ["1", "true", "yes", "on"].includes(
(process.env.NEXT_PUBLIC_FEATURE_PHASE_171 ?? "").trim().toLowerCase(),
)
/** @type {import('next').NextConfig} */
const nextConfig = {
// Spike 608 (phase-175): bonded with next 16.2.2 + react 19.2.0 + @stellar/stellar-sdk ^15.0.1
transpilePackages: ["@creit.tech/stellar-wallets-kit"],
...(phase172Enabled
? {
optimizePackageImports: ["lucide-react", "@radix-ui/react-icons", "recharts", "date-fns"],
bundlePagesRouterDependencies: true,
}
: {}),
// Rust build trees are committed in this repo; exclude from serverless traces (250 MB limit on Vercel).
outputFileTracingExcludes: {
"*": ["./contracts/**/*", "./scripts/**/*"],
},
images: {
...(phase171Enabled
? {
formats: ["image/avif", "image/webp"],
minimumCacheTTL: 86400,
deviceSizes: [320, 480, 640, 768, 1024, 1280, 1536, 1920],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
}
: {}),
remotePatterns: [
{
protocol: "https",
hostname: "gateway.pinata.cloud",
pathname: "/ipfs/**",
},
{
protocol: "https",
hostname: "ipfs.io",
pathname: "/ipfs/**",
},
{
protocol: "https",
hostname: "dweb.link",
pathname: "/ipfs/**",
},
{
protocol: "https",
hostname: "*.nanobananaapi.ai",
pathname: "/**",
},
{
protocol: "https",
hostname: "nanobananaapi.ai",
pathname: "/**",
},
],
},
async headers() {
return [
{
source: "/.well-known/:association(assetlinks.json|apple-app-site-association)",
headers: [
{ key: "Content-Type", value: "application/json" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Cache-Control", value: "public, max-age=300" },
],
},
// Security headers — applied to every route
{
source: "/(.*)",
headers: [
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
{ key: "Cross-Origin-Opener-Policy", value: "same-origin-allow-popups" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Permissions-Policy", value: "camera=(self), microphone=(), geolocation=()" },
{
key: "Content-Security-Policy",
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-eval' 'unsafe-inline' https://vercel.live https://va.vercel-scripts.com",
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
"img-src 'self' data: blob: https: http:",
"font-src 'self' data: https://fonts.gstatic.com",
"connect-src 'self' https: wss: http://localhost:* ws://localhost:*",
"frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://albedo.link",
"worker-src 'self' blob:",
"child-src 'self' blob:",
"form-action 'self'",
"base-uri 'self'",
"manifest-src 'self'",
].join("; "),
},
],
},
{
source: "/.well-known/stellar.toml",
headers: [
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET, OPTIONS" },
{ key: "Access-Control-Allow-Headers", value: "Content-Type" },
],
},
// Static assets: long-lived cache with immutable hash
{
source: "/_next/static/(.*)",
headers: [
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
],
},
// Image optimization: edge cache with revalidation
{
source: "/_next/image(.*)",
headers: [
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
],
},
// Font files: long cache with CDN edge strategy
{
source: "/fonts/(.*)",
headers: [
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
{ key: "X-Content-Type-Options", value: "nosniff" },
],
},
// HTML pages: short-lived, stale-while-revalidate for edge freshness
{
source: "/:path*",
has: [{ type: "header", key: "accept", value: "(?=.*html)" }],
headers: [
{ key: "Cache-Control", value: "public, max-age=3600, stale-while-revalidate=86400" },
],
},
{
source: "/phaser-liq-token.png",
headers: [
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Cross-Origin-Resource-Policy", value: "cross-origin" },
{ key: "Cache-Control", value: "public, max-age=86400, must-revalidate" },
],
},
{
source: "/assets/(.*)",
headers: [
{ key: "Cache-Control", value: "public, max-age=86400, must-revalidate" },
],
},
]
},
}
export default nextConfig