-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnext.config.mjs
More file actions
103 lines (97 loc) · 3.11 KB
/
next.config.mjs
File metadata and controls
103 lines (97 loc) · 3.11 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Standalone output for optimized Docker deployments
// Reduces image size from ~1GB to ~100MB and memory usage significantly
output: 'standalone',
// Security headers
async headers() {
// Environment-based CSP configuration
const isProduction = process.env.NODE_ENV === 'production'
// Note: 'wasm-unsafe-eval' is required for @react-pdf/renderer which uses WebAssembly
const scriptSrc = isProduction
? "'self' 'unsafe-inline' 'wasm-unsafe-eval' https://www.google.com https://www.gstatic.com https://libre-astrology.vercel.app"
: "'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' https://www.google.com https://www.gstatic.com https://libre-astrology.vercel.app"
return [
{
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=(self), interest-cohort=()',
},
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
{
key: 'X-Permitted-Cross-Domain-Policies',
value: 'none',
},
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
`script-src ${scriptSrc}`,
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
"connect-src 'self' https://secure.geonames.org https://openrouter.ai https://www.google.com https://api.dodopayments.com https://libre-astrology.vercel.app",
"frame-src 'self' blob: https://www.google.com https://app.dodopayments.com https://*.dodopayments.com",
"frame-ancestors 'self'",
"form-action 'self'",
"base-uri 'self'",
"object-src 'none'",
].join('; '),
},
],
},
]
},
// Logging configuration
logging: {
fetches: {
fullUrl: process.env.NODE_ENV === 'development',
},
},
// Experimental features
experimental: {
// Enable Server Actions (stable in Next.js 14+)
serverActions: {
bodySizeLimit: '2mb',
},
},
// Image optimization
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{
protocol: 'https',
hostname: 'cdn.statically.io',
pathname: '/gh/g-battaglia/AstrologerStudio@main/CDN/**',
},
],
},
// Powered by header disabled for security
poweredByHeader: false,
}
export default nextConfig