-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.js
More file actions
100 lines (93 loc) · 2.97 KB
/
next.config.js
File metadata and controls
100 lines (93 loc) · 2.97 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
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
// Remove the old i18n config
// i18n: {
// locales: ['en', 'ja'],
// defaultLocale: 'en',
// domains: [
// {
// domain: 'opensourceavatars.com',
// defaultLocale: 'ja',
// locales: ['ja'],
// },
// {
// domain: 'opensourceavatars.com',
// defaultLocale: 'en',
// locales: ['en'],
// },
// ],
// },
// Add middleware configuration for i18n
experimental: {
// Keep existing experimental configs
serverComponentsExternalPackages: ['@prisma/client'],
},
// Rest of your existing config...
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'assets.opensourceavatars.com',
},
{
protocol: 'https',
hostname: 'assetsdev.opensourceavatars.com',
}
],
unoptimized: process.env.NODE_ENV === 'development'
},
output: 'standalone',
// Note: Docs folder is copied to standalone build via scripts/copy-docs.js
// This ensures all markdown files are available at runtime
// Configure dynamic route handling
async rewrites() {
return [
{
source: '/api/:path*',
destination: '/api/:path*'
}
]
},
async headers() {
return [
{
// Security headers for all pages
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: blob:; font-src 'self' data:; connect-src 'self' blob: https://*.ipfs.io https://dweb.link https://*.dweb.link https://gateway.pinata.cloud https://*.arweave.net https://arweave.net https://raw.githubusercontent.com https://api.github.com https://*.githubusercontent.com https://assets.opensourceavatars.com; frame-ancestors 'self';"
},
{
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: 'geolocation=(), microphone=(), camera=()'
}
],
},
{
// CORS headers for API routes (keep existing)
source: '/api/:path*',
headers: [
{ key: 'Access-Control-Allow-Credentials', value: 'true' },
{ key: 'Access-Control-Allow-Origin', value: '*' },
{ key: 'Access-Control-Allow-Methods', value: 'GET,DELETE,PATCH,POST,PUT' },
{ key: 'Access-Control-Allow-Headers', value: 'Authorization, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version' },
],
},
];
}
};
module.exports = nextConfig;