-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
154 lines (149 loc) · 3.77 KB
/
next.config.ts
File metadata and controls
154 lines (149 loc) · 3.77 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
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
// Note: upgrade-insecure-requests was removed - it can break CSS/asset loading when
// deployed behind reverse proxies (e.g. Dokploy). HSTS header already enforces HTTPS.
const contentSecurityPolicy = [
"default-src 'self'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
"object-src 'none'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
"connect-src 'self' https:",
"manifest-src 'self'",
].join("; ");
const securityHeaders = [
{
key: "Content-Security-Policy",
value: contentSecurityPolicy,
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=(), browsing-topics=()",
},
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
];
const nextConfig: NextConfig = {
/* config options here */
reactStrictMode: false,
poweredByHeader: false,
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*",
},
{
source: "/ingest/decide",
destination: "https://eu.i.posthog.com/decide",
},
];
},
async redirects() {
return [
{
source: "/ambassador",
destination: "/community/ambassador",
permanent: true,
},
{
source: "/collaboration-questionnaire",
destination: "/sea/collaboration",
permanent: true,
},
{
source: "/task-automation",
destination: "/framework/software-engineering",
permanent: true,
},
{
source: "/world-simulation",
destination: "/framework/social-simulation",
permanent: true,
},
{
source: "/data-generation",
destination: "/framework/data-training",
permanent: true,
},
{
source: "/launchweek-environments",
destination: "/sea",
permanent: true,
},
{
source: "/mcp",
destination: "https://mcp.camel-ai.org",
permanent: true,
basePath: false,
},
];
},
async headers() {
return [
{
source: "/package/:file",
headers: [
{
key: "Content-Disposition",
value: "attachment",
},
],
},
{
source: "/:path*",
headers: securityHeaders,
},
];
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
images: {
remotePatterns: [
{
protocol: "https",
hostname: "lh3.googleusercontent.com",
},
{
protocol: "https",
hostname: "avatars.githubusercontent.com",
},
],
formats: ["image/avif", "image/webp"],
minimumCacheTTL: 31536000, // 1 year cache for optimized images
// CDN-style responsive breakpoints for optimized image delivery
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048],
imageSizes: [16, 32, 48, 64, 96, 128, 256],
},
// Performance optimizations
compiler: {
removeConsole: process.env.NODE_ENV === "production",
},
experimental: {
optimizePackageImports: ["lucide-react", "framer-motion"],
},
};
export default withNextIntl(nextConfig);