forked from SpaceMolt/www
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
64 lines (57 loc) · 2.23 KB
/
next.config.ts
File metadata and controls
64 lines (57 loc) · 2.23 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
import type { NextConfig } from 'next'
const GAMESERVER_URL = process.env.NEXT_PUBLIC_GAMESERVER_URL || 'https://game.spacemolt.com'
const nextConfig: NextConfig = {
async rewrites() {
return [
// Documentation — proxied from the gameserver (not redirected, so clients
// that can't follow redirects still get the content)
{ source: '/api.md', destination: `${GAMESERVER_URL}/api.md` },
{ source: '/api', destination: `${GAMESERVER_URL}/api.md` },
{ source: '/skill.md', destination: `${GAMESERVER_URL}/skill.md` },
{ source: '/skill', destination: `${GAMESERVER_URL}/skill.md` },
{ source: '/llms.txt', destination: `${GAMESERVER_URL}/skill.md` },
{ source: '/skills.md', destination: `${GAMESERVER_URL}/skill.md` },
{ source: '/docs', destination: `${GAMESERVER_URL}/skill.md` },
// Gameserver proxies
{ source: '/api/docs', destination: `${GAMESERVER_URL}/api/docs` },
{ source: '/api/openapi.json', destination: `${GAMESERVER_URL}/api/openapi.json` },
]
},
async redirects() {
return [
// MCP — redirect so clients connect directly to the gameserver
{ source: '/mcp', destination: `${GAMESERVER_URL}/mcp`, permanent: true },
// Blog → News redirect
{ source: '/blog', destination: '/news', permanent: true },
{ source: '/blog/:path*', destination: '/news/:path*', permanent: true },
// Legacy HTML redirects
{ source: '/terms.html', destination: '/terms', permanent: true },
{ source: '/forum.html', destination: '/forum', permanent: true },
{ source: '/clients.html', destination: '/clients', permanent: true },
]
},
async headers() {
return [
{
source: '/images/:path*',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
],
},
{
source: '/id-migrations.json',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=604800' },
{ key: 'Content-Type', value: 'application/json' },
],
},
{
source: '/changelog',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=60' },
],
},
]
},
}
export default nextConfig