-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
274 lines (259 loc) · 8.73 KB
/
Copy pathnext.config.ts
File metadata and controls
274 lines (259 loc) · 8.73 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
import type {NextConfig} from 'next'
// Static browser security response headers applied to every route.
//
// Content-Security-Policy is intentionally NOT here — it carries a per-request
// nonce and is set in src/middleware.ts. These headers are static, so they stay
// in the config where they can be CDN-cached with the rest of the response.
//
// HSTS: HTTPS-only is served by Vercel. includeSubDomains + preload is a
// hard-to-reverse commitment for every *.doubleword.ai host — kept in step with
// the ingress-nginx HSTS config in the internal repo.
const securityHeaders = [
{key: 'X-Content-Type-Options', value: 'nosniff'},
{key: 'X-Frame-Options', value: 'DENY'},
{key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin'},
{
key: 'Permissions-Policy',
value:
'accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=(), interest-cohort=()',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
]
const nextConfig: NextConfig = {
reactCompiler: true,
// Apply security response headers to every route.
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
]
},
// Enable detailed logging for cache debugging
logging: {
fetches: {
fullUrl: true,
},
},
// PostHog reverse proxy configuration
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://eu-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://eu.i.posthog.com/:path*",
},
// Markdown: /product.md → /api/markdown/product (aggregated)
{
source: "/:product.md",
destination: "/api/markdown/:product",
},
// Markdown: /product/slug.md → /api/markdown/product/slug
{
source: "/:product/:path*.md",
destination: "/api/markdown/:product/:path*",
},
];
},
// Required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
// Allow images from Sanity CDN
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'cdn.sanity.io',
},
],
},
// Redirects for URL migration from old Docusaurus site
async redirects() {
return [
// =====================================================
// BLOG POSTS: /conceptual/* → blog.doubleword.ai/*
// Old Docusaurus used filename as slug (e.g., /conceptual/15-07-2025-bts-8)
// =====================================================
// Behind the Stack episodes
{
source: '/conceptual/28-05-2025-bts-1',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-1-what-should-i-be-observing-in-my-llm-stack',
permanent: true,
},
{
source: '/conceptual/10-06-2025-bts-2',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-2-how-many-users-can-my-gpu-serve',
permanent: true,
},
{
source: '/conceptual/04-06-2025-bts-3',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-3-how-to-serve-100-models-on-a-single-gpu-with-no-cold-starts',
permanent: true,
},
{
source: '/conceptual/18-06-2025-bts-4',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-4-making-your-load-balancer-llm-aware',
permanent: true,
},
{
source: '/conceptual/24-06-2025-bts-5',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-5-making-rag-work-for-multimodal-documents',
permanent: true,
},
{
source: '/conceptual/01-07-2025-bts-6',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-6-how-to-speed-up-the-inference-of-ai-agents',
permanent: true,
},
{
source: '/conceptual/09-07-2025-bts-7',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-7-choosing-the-right-quantization-for-self-hosted-llms',
permanent: true,
},
{
source: '/conceptual/15-07-2025-bts-8',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-8-choosing-the-right-inference-engine-for-your-llm-deployment',
permanent: true,
},
{
source: '/conceptual/03-09-2025-bts-9',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-9-how-to-evaluate-open-source-llms',
permanent: true,
},
{
source: '/conceptual/03-09-2025-bts-10',
destination: 'https://blog.doubleword.ai/behind-the-stack-ep-10-batched-endpoints',
permanent: true,
},
// Other blog posts
{
source: '/conceptual/06-10-2025-chargeback',
destination: 'https://blog.doubleword.ai/understanding-chargeback-in-the-context-of-self-hosted-systems',
permanent: true,
},
{
source: '/conceptual/06-10-2025-picking-a-model',
destination: 'https://blog.doubleword.ai/choosing-the-right-model-for-the-use-case',
permanent: true,
},
{
source: '/conceptual/08-12-2025-batch-usecase',
destination: 'https://blog.doubleword.ai/1-for-a-year-of-research-digests',
permanent: true,
},
{
source: '/conceptual/08-12-2025-batch',
destination: 'https://blog.doubleword.ai/why-batch-inference-matters',
permanent: true,
},
{
source: '/conceptual/21-19-2025-dwctl-benchmark',
destination: 'https://blog.doubleword.ai/benchmarking-doubleword-control-layer',
permanent: true,
},
// Catch-all for /conceptual index
{
source: '/conceptual',
destination: 'https://blog.doubleword.ai',
permanent: true,
},
// =====================================================
// PRODUCT SLUG MIGRATION: /batches → /inference-api
// =====================================================
{
source: '/batches',
destination: '/inference-api',
permanent: true,
},
{
source: '/batches/:path*',
destination: '/inference-api/:path*',
permanent: true,
},
// =====================================================
// CHANGED DOC SLUGS
// =====================================================
{
source: '/inference-api/real-time-api',
destination: '/inference-api/realtime-inference',
permanent: true,
},
{
source: '/inference-api/getting-started-with-batched-api',
destination: '/inference-api/batch-inference',
permanent: true,
},
{
source: '/inference-api/model-pricing',
destination: '/inference-api/models',
permanent: true,
},
{
source: '/inference-stack/deployment/first',
destination: '/inference-stack/deployment/first-deployment',
permanent: true,
},
{
source: '/inference-stack/deployment/loading',
destination: '/inference-stack/deployment/faster-model-loading',
permanent: true,
},
{
source: '/inference-stack/usage/active',
destination: '/inference-stack/usage/active-monitoring',
permanent: true,
},
// =====================================================
// MISSING INDEX PAGES → redirect to first doc in section
// =====================================================
{
source: '/control-layer/usage',
destination: '/control-layer/usage/models-and-access',
permanent: true,
},
{
source: '/control-layer/reference',
destination: '/control-layer/reference/configuration',
permanent: true,
},
{
source: '/control-layer/usage/admin',
destination: '/control-layer/admin/model-sources',
permanent: true,
},
{
source: '/inference-stack/deployment',
destination: '/inference-stack/deployment/first-deployment',
permanent: true,
},
{
source: '/inference-stack/usage',
destination: '/inference-stack/usage/metrics',
permanent: true,
},
// Old nested admin paths → new flat admin paths
{
source: '/control-layer/usage/admin/model-sources',
destination: '/control-layer/admin/model-sources',
permanent: true,
},
{
source: '/control-layer/usage/admin/model-monitoring',
destination: '/control-layer/admin/model-monitoring',
permanent: true,
},
{
source: '/control-layer/usage/admin/users-and-groups',
destination: '/control-layer/admin/users-and-groups',
permanent: true,
},
]
},
}
export default nextConfig