-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
66 lines (63 loc) · 2.27 KB
/
Copy pathnext.config.ts
File metadata and controls
66 lines (63 loc) · 2.27 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
import type { NextConfig } from "next";
import { wwwToApexRedirects } from "./src/lib/site-identity";
const securityHeaders = [
{ key: "X-DNS-Prefetch-Control", value: "on" },
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=()",
},
{
key: "Content-Security-Policy",
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval'",
"style-src 'self' 'unsafe-inline'",
// Contribution / banner images: twimg avatars, Vercel Blob, plus CDNs
// ContentBody already recognizes (imgur, GitHub user content).
"img-src 'self' data: blob: https://pbs.twimg.com https://abs.twimg.com https://api.dicebear.com https://*.public.blob.vercel-storage.com https://*.blob.vercel-storage.com https://i.imgur.com https://imgur.com https://raw.githubusercontent.com https://user-images.githubusercontent.com https://*.githubusercontent.com",
"font-src 'self' data:",
"connect-src 'self' https://api.x.com https://x.com https://api.stripe.com",
"frame-ancestors 'self'",
"base-uri 'self'",
"form-action 'self' https://x.com https://twitter.com https://api.x.com",
].join("; "),
},
];
const nextConfig: NextConfig = {
// Native ws + Neon driver must not be bundled into Server Components.
serverExternalPackages: [
"@neondatabase/serverless",
"@prisma/adapter-neon",
"ws",
],
// Banner uploads (client-resized ~900KB) need headroom above the 1MB default.
experimental: {
serverActions: {
bodySizeLimit: "2mb",
},
},
images: {
remotePatterns: [
{ protocol: "https", hostname: "pbs.twimg.com" },
{ protocol: "https", hostname: "abs.twimg.com" },
{ protocol: "https", hostname: "api.dicebear.com" },
{ protocol: "https", hostname: "*.public.blob.vercel-storage.com" },
{ protocol: "https", hostname: "*.blob.vercel-storage.com" },
],
},
async headers() {
return [
{
source: "/:path*",
headers: securityHeaders,
},
];
},
async redirects() {
return wwwToApexRedirects();
},
};
export default nextConfig;