-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
107 lines (98 loc) · 2.57 KB
/
next.config.ts
File metadata and controls
107 lines (98 loc) · 2.57 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
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
// Move serverComponentsExternalPackages to the correct location
serverExternalPackages: [],
// Override default request size limits for file uploads
experimental: {
// Set maximum request body size to 10GB for large file support
serverActions: {
bodySizeLimit: '10gb',
},
// Increase memory limits for large files
largePageDataBytes: 128 * 1000000, // 128MB for page data
// Enable large payloads
allowedRevalidateHeaderKeys: ['x-revalidate'],
},
// Custom server configuration for large file handling
serverRuntimeConfig: {
maxFileSize: '10gb',
},
// Set custom webpack config for larger payloads
webpack: (config: any, { isServer }) => {
if (isServer) {
// Server-side configurations for large files - webpack 5 syntax
config.resolve = config.resolve || {};
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
};
}
return config;
},
// Configure on-demand entries for better performance
onDemandEntries: {
// period (in ms) where the server will keep pages in the buffer
maxInactiveAge: 25 * 1000,
// number of pages that should be kept simultaneously without being disposed
pagesBufferLength: 2,
},
// Force HTTPS in production
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload'
},
{
key: 'X-Frame-Options',
value: 'DENY'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin'
}
],
},
];
},
// Redirect HTTP to HTTPS
async redirects() {
return [
{
source: '/(.*)',
has: [
{
type: 'header',
key: 'x-forwarded-proto',
value: 'http',
},
],
destination: 'https://metalfiles.tech/:path*',
permanent: true,
},
// Redirect www to non-www
{
source: '/(.*)',
has: [
{
type: 'host',
value: 'www.metalfiles.tech',
},
],
destination: 'https://metalfiles.tech/:path*',
permanent: true,
},
];
},
};
export default nextConfig;