-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
45 lines (40 loc) · 1.02 KB
/
Copy pathnext.config.ts
File metadata and controls
45 lines (40 loc) · 1.02 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
import type { NextConfig } from "next";
const isProd = process.env.NODE_ENV === "production";
const scriptSrc = isProd
? "script-src 'self' 'unsafe-inline'"
: "script-src 'self' 'unsafe-inline' 'unsafe-eval'";
const contentSecurityPolicy = [
"default-src 'self'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
"img-src 'self' data: https:",
scriptSrc,
"style-src 'self' 'unsafe-inline'",
"font-src 'self' data:",
"connect-src 'self' https: wss:",
"object-src 'none'",
].join("; ");
const securityHeaders = [
{
key: "Content-Security-Policy",
value: contentSecurityPolicy,
},
{
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains; preload",
},
];
const nextConfig: NextConfig = {
// logging: { fetches: { fullUrl: true } },
allowedDevOrigins: ["192.168.1.*", "localhost", "127.0.0.1"],
async headers() {
return [
{
source: "/(.*)",
headers: securityHeaders,
},
];
},
};
export default nextConfig;