forked from vestflow-labs/vestflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
46 lines (41 loc) · 1.16 KB
/
Copy pathnext.config.ts
File metadata and controls
46 lines (41 loc) · 1.16 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
import type { NextConfig } from "next";
const isMainnet = process.env.NEXT_PUBLIC_NETWORK === "mainnet";
/**
* Allowed Soroban RPC origins vary by network.
* Extend the connect-src directive if you use an alternative RPC endpoint.
*/
const rpcOrigin = isMainnet
? "https://mainnet.sorobanrpc.com"
: "https://soroban-testnet.stellar.org";
/**
* Content Security Policy for VestFlow.
*
* `connect-src` covers XHR / fetch / WebSocket connections made by the
* browser — this is the critical directive for Soroban RPC calls.
*/
const cspHeader = [
`default-src 'self'`,
`script-src 'self' 'unsafe-inline' 'unsafe-eval'`,
`style-src 'self' 'unsafe-inline'`,
`img-src 'self' data: blob:`,
`font-src 'self'`,
`connect-src 'self' ${rpcOrigin} https://horizon.stellar.org https://horizon-testnet.stellar.org`,
`frame-ancestors 'none'`,
].join("; ");
const nextConfig: NextConfig = {
async headers() {
return [
{
// Apply CSP to all routes
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: cspHeader,
},
],
},
];
},
};
export default nextConfig;