-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
77 lines (72 loc) · 1.66 KB
/
Copy pathnext.config.ts
File metadata and controls
77 lines (72 loc) · 1.66 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
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Enable WebAssembly support
webpack: (config) => {
config.experiments = {
...config.experiments,
asyncWebAssembly: true,
};
return config;
},
// Configure external image domains
images: {
remotePatterns: [
{
protocol: "https",
hostname: "cdn.marble.worldlabs.ai",
},
],
},
// Add COOP/COEP headers for SharedArrayBuffer support (required by Rapier)
async headers() {
return [
{
source: "/:path*",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
// Add CORP header for proxied CDN resources
source: "/cdn-proxy/:path*",
headers: [
{
key: "Cross-Origin-Resource-Policy",
value: "cross-origin",
},
],
},
{
// Add CORP header for proxied GCS resources
source: "/gcs-proxy/:path*",
headers: [
{
key: "Cross-Origin-Resource-Policy",
value: "cross-origin",
},
],
},
];
},
// Proxy Marble CDN and GCS through our domain to bypass CORS
async rewrites() {
return [
{
source: "/cdn-proxy/:path*",
destination: "https://cdn.marble.worldlabs.ai/:path*",
},
{
source: "/gcs-proxy/:path*",
destination: "https://storage.googleapis.com/:path*",
},
];
},
};
export default nextConfig;