-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathnext.config.mjs
More file actions
108 lines (104 loc) · 2.92 KB
/
next.config.mjs
File metadata and controls
108 lines (104 loc) · 2.92 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { createMDX } from 'fumadocs-mdx/next';
const withMDX = createMDX();
const dashboardUrl = process.env.NEXT_PUBLIC_STACK_DASHBOARD_URL || 'http://localhost:8101';
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
eslint: {
// Temporarily disable ESLint during builds for Vercel deployment
ignoreDuringBuilds: false,
},
async headers() {
return [
{
// Allow CORS for docs-embed routes to be accessed by the dashboard app
source: '/docs-embed/:path*',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: dashboardUrl, // Dashboard app origin
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET, POST, PUT, DELETE, OPTIONS',
},
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization',
},
],
},
{
// Allow CORS for api-embed routes to be accessed by the dashboard app
source: '/api-embed/:path*',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: dashboardUrl, // Dashboard app origin
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET, POST, PUT, DELETE, OPTIONS',
},
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization',
},
],
},
];
},
// Include OpenAPI files in output tracing for Vercel deployments
outputFileTracingIncludes: {
'/**/*': ['./content/**/*', './openapi/**/*'],
},
async redirects() {
return [
// Redirect root to docs overview
{
source: '/',
destination: '/docs/overview',
permanent: false,
},
// Redirect /docs/api to the overview page
{
source: '/docs/api',
destination: '/docs/api/overview',
permanent: false,
},
];
},
async rewrites() {
return [
// PostHog proxy rewrites to prevent ad blockers
{
source: "/consume/static/:path*",
destination: "https://eu-assets.i.posthog.com/static/:path*",
},
{
source: "/consume/:path*",
destination: "https://eu.i.posthog.com/:path*",
},
{
source: "/consume/decide",
destination: "https://eu.i.posthog.com/decide",
},
// Redirect .mdx requests to the llms.mdx route handler
{
source: '/docs/:path*.mdx',
destination: '/llms.mdx/:path*',
},
{
source: '/api/:path*.mdx',
destination: '/llms.mdx/:path*',
},
// Serve OpenAPI files from the openapi directory
{
source: '/openapi/:path*',
destination: '/openapi/:path*',
},
// No other rewrites needed for API docs - they're served directly from /docs/api/*
];
},
};
export default withMDX(config);