forked from zitadel/zitadel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
164 lines (158 loc) · 4.49 KB
/
Copy pathnext.config.mjs
File metadata and controls
164 lines (158 loc) · 4.49 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import { createMDX } from 'fumadocs-mdx/next';
import { rehypeCode } from 'fumadocs-core/mdx-plugins';
import { promises as fs } from 'fs';
import { URL } from 'url';
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
basePath: '/docs',
outputFileTracingIncludes: {
'/**': ['./openapi/**/*', './content/**/*', './.source/**/*'],
},
async redirects() {
try {
const redirectsPath = new URL('./redirects.json', import.meta.url);
const redirectsContent = await fs.readFile(redirectsPath, 'utf-8');
const generatedRedirects = JSON.parse(redirectsContent);
return [
...generatedRedirects,
{
source: '/',
destination: '/docs',
basePath: false,
permanent: false,
},
{
source: '/img/:path*',
destination: '/docs/img/:path*',
basePath: false,
permanent: false,
},
];
} catch (e) {
console.warn('Could not load redirects.json', e);
return [
{
source: '/',
destination: '/docs',
basePath: false,
permanent: false,
},
{
source: '/img/:path*',
destination: '/docs/img/:path*',
basePath: false,
permanent: false,
},
];
}
},
async rewrites() {
return [
{
source: '/favicon.ico',
destination: 'https://zitadel.com/favicon.ico',
basePath: false,
},
{
source: '/mp/lib.min.js',
destination: 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js',
},
{
source: '/mp/lib.js',
destination: 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.js',
},
{
source: '/mp/decide',
destination: 'https://decide.mixpanel.com/decide',
},
{
source: '/mp/:slug*',
destination: 'https://api-eu.mixpanel.com/:slug*',
},
{
source: '/pl/js/script.js',
destination: 'https://plausible.io/js/script.js',
},
{
source: '/pl/api/event',
destination: 'https://plausible.io/api/event',
},
];
},
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: `default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.youtube.com https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://www.gstatic.com/charts/ https://www.youtube.com/; child-src zitadel.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://www.gstatic.com/charts/ zitadel.com; font-src 'self' https://fonts.gstatic.com https://fonts.googleapis.com; object-src 'none'; connect-src 'self' https://raw.githubusercontent.com/zitadel/ https://api.inkeep.com https://api.io.inkeep.com https://www.youtube.com; frame-src https://www.youtube.com/ https://www.google.com/recaptcha/ https://recaptcha.google.com/recaptcha/; img-src 'self' https://raw.githubusercontent.com/devicons/devicon/master/icons/ https://i.ytimg.com https://yt3.ggpht.com data: `,
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'Permissions-Policy',
value: 'payment=(self "https://js.stripe.com")',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
],
},
];
},
turbopack: {
rules: {
'*.{go,yaml,Caddyfile,conf}': {
loaders: ['raw-loader'],
as: '*.js',
},
},
},
webpack: (config) => {
config.module.rules.push({
test: /\.(go|yaml|Caddyfile|conf)$/,
type: 'asset/source',
});
return config;
},
};
const withMDX = createMDX({
mdxOptions: {
rehypePlugins: [
[
rehypeCode,
{
langs: [
'bash',
'yaml',
'json',
'go',
'typescript',
'javascript',
'sql',
'prometheus',
'promql',
],
},
],
],
},
});
export default withMDX(nextConfig);