Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
65 lines (63 loc) · 2.55 KB
/
Copy pathnext.config.ts
File metadata and controls
65 lines (63 loc) · 2.55 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
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// The catalog lives in content/*.json and is read with fs at render time.
// Static analysis can't see dynamic readdir calls, so include the content
// dir in every route's trace (agents.json, /api/mcp, dynamic fallbacks).
outputFileTracingIncludes: {
"/**": ["./content/**", "./CHANGELOG.md"],
},
// The moment of the build, inlined into every bundle. lib/freshness.ts
// counts "new" from the build's day, so prerendered pages and pages
// rendered per request (/browse) agree on which listings are new.
env: { BUILD_TIME: String(Date.now()) },
// `/` answers as HTML or Markdown depending on Accept (see proxy.ts).
// The proxy sets Vary too, but the renderer overwrites it on the HTML
// branch, so declare it here as well — otherwise a CDN can cache the HTML
// variant and hand it to an agent that asked for Markdown. On Vercel the
// prerendered HTML still loses it (vercel.json headers do not help either);
// Vercel's own cache is safe because proxy.ts runs before it.
async redirects() {
return [
{ source: "/tos", destination: "/terms", permanent: true },
{ source: "/TOS", destination: "/terms", permanent: true },
// The site card's URL before per-page share cards (lib/share-cards.ts).
{ source: "/opengraph-image", destination: "/card.png", permanent: true },
// Pro Access was a placeholder; paid placement is a Sponsored slot.
{ source: "/pro", destination: "/advertise", permanent: true },
];
},
async rewrites() {
return [{ source: "/SKILL.md", destination: "/skill.md" }];
},
async headers() {
const cors = [
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET, OPTIONS" },
];
return [
{
source: "/",
headers: [{ key: "Vary", value: "Accept, Accept-Encoding" }],
},
{ source: "/openapi.json", headers: cors },
{
source: "/skill.md",
headers: [
...cors,
{ key: "Content-Type", value: "text/markdown; charset=utf-8" },
],
},
{ source: "/connector-icon.png", headers: cors },
{
// Every icon URL the site and its APIs hand out carries ?v=<content
// hash> (lib/icons.ts), so a changed icon always has a new URL.
source: "/icons/:path*",
headers: [
...cors,
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
],
},
];
},
};
export default nextConfig;