-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.mjs
More file actions
56 lines (52 loc) · 1.5 KB
/
Copy pathnext.config.mjs
File metadata and controls
56 lines (52 loc) · 1.5 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
import path from "node:path";
const contentSecurityPolicyReportOnly = [
"default-src 'self'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
"object-src 'none'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
"connect-src 'self' https: ws: wss:",
"worker-src 'self' blob:",
"media-src 'self' blob:",
"manifest-src 'self'",
].join("; ");
const securityHeaders = [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" },
{ key: "Content-Security-Policy-Report-Only", value: contentSecurityPolicyReportOnly },
];
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: "standalone",
outputFileTracingRoot: path.resolve("."),
serverExternalPackages: ["better-sqlite3"],
compress: true,
poweredByHeader: false,
productionBrowserSourceMaps: false,
images: {
unoptimized: false,
formats: ["image/avif", "image/webp"],
deviceSizes: [375, 640, 768, 1024, 1440, 1920],
},
experimental: {
optimizePackageImports: ["lucide-react"],
cpus: 1,
},
// 安全响应头
async headers() {
return [
{
source: "/(.*)",
headers: securityHeaders,
},
];
},
};
export default nextConfig;