-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.mjs
More file actions
42 lines (38 loc) · 1.54 KB
/
Copy pathnext.config.mjs
File metadata and controls
42 lines (38 loc) · 1.54 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
import { dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
/** @type {import('next').NextConfig} */
const nextConfig = {
// Turbopack is the default bundler in Next.js 16.
// Node.js built-in modules (crypto, buffer, etc.) used by @stacks/transactions
// are only imported in API routes (server-side), so no browser fallbacks needed.
turbopack: {
root: __dirname,
},
async headers() {
return [
{
// Apply CORS headers to all API Vault gateway routes
source: "/api/v/:path*",
headers: [
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET, POST, PUT, PATCH, DELETE, OPTIONS" },
{ key: "Access-Control-Allow-Headers", value: "Content-Type, x-payment" },
{ key: "Access-Control-Expose-Headers", value: "x-payment-response" },
{ key: "Access-Control-Max-Age", value: "86400" },
],
},
{
source: "/v/:path*",
headers: [
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET, POST, PUT, PATCH, DELETE, OPTIONS" },
{ key: "Access-Control-Allow-Headers", value: "Content-Type, x-payment" },
{ key: "Access-Control-Expose-Headers", value: "x-payment-response" },
{ key: "Access-Control-Max-Age", value: "86400" },
],
},
];
},
};
export default nextConfig;