-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
63 lines (59 loc) · 1.75 KB
/
next.config.ts
File metadata and controls
63 lines (59 loc) · 1.75 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
import type {NextConfig} from "next";
import path from "node:path";
const EDITION = process.env.EDITION ?? "ce";
const SAGITTARIUS_GRAPHQL_URL = process.env.SAGITTARIUS_GRAPHQL_URL ?? 'http://localhost:3010/graphql';
const cspHeader = `
default-src 'self';
script-src 'self' 'unsafe-eval' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
img-src 'self';
font-src 'self';
object-src 'none';
base-uri 'self';
form-action 'self';
frame-ancestors 'none';
worker-src 'self' blob: data: *;
connect-src 'self' ${SAGITTARIUS_GRAPHQL_URL} ${process.env.NEXT_PUBLIC_OTEL_LOGS_ENDPOINT} ${process.env.NEXT_PUBLIC_OTEL_TRACES_ENDPOINT};
`
const nextConfig: NextConfig = {
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader.replace(/\n/g, ''),
},
{
key: "X-Frame-Options",
value: "DENY"
}
],
},
]
},
reactStrictMode: true,
reactCompiler: true,
turbopack: {
resolveAlias: {
"@edition": path.resolve(__dirname, `src/packages/${EDITION}/src`),
"@core": path.resolve(__dirname, "src/packages/core/src"),
},
rules: {
"*.graphql": {
loaders: ["graphql-tag/loader"],
as: "*.js"
},
},
},
rewrites: () => {
return [
{
source: '/graphql',
destination: SAGITTARIUS_GRAPHQL_URL // Proxy to Backend
}
];
}
};
export default nextConfig;