-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
142 lines (130 loc) · 3.9 KB
/
Copy pathnext.config.js
File metadata and controls
142 lines (130 loc) · 3.9 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Server-side rendering settings for Render
// output: 'standalone', // Temporarily disabled to fix routing issues
trailingSlash: true, // Enable for better compatibility
// Build configuration
generateBuildId: async () => {
return 'build-' + Date.now()
},
// Experimental features
experimental: {
esmExternals: false,
},
// Images configuration
images: {
domains: ['localhost', 'render.com'],
remotePatterns: [
{
protocol: 'https',
hostname: '**.render.com',
},
],
unoptimized: true, // For static export compatibility
},
// Production optimizations
compress: true,
poweredByHeader: false,
generateEtags: false,
distDir: '.next',
swcMinify: true,
// Custom webpack configuration
webpack: (config, { isServer }) => {
// Handle file system fallbacks
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
// Exclude working folders from compilation
config.module.rules.push({
test: /\.(ts|tsx|js|jsx)$/,
exclude: [
/node_modules/,
/market page working/,
/backup/,
],
});
// Handle pdf-parse build issues
config.module.rules.push({
test: /\.node$/,
use: 'raw-loader',
});
config.externals = config.externals || [];
config.externals.push({
'pdf-parse': 'commonjs pdf-parse',
});
return config;
},
// Enhanced security headers
async redirects() {
return [
{
source: '/treadgpt',
destination: '/tradeaxis',
permanent: true,
},
]
},
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://s3.tradingview.com https://charting-library.tradingview.com https://*.tradingview.com; style-src 'self' 'unsafe-inline' https://charting-library.tradingview.com https://*.tradingview.com; img-src 'self' data: blob: https: https://s3.tradingview.com https://*.tradingview.com; font-src 'self' data: https://charting-library.tradingview.com https://*.tradingview.com; connect-src 'self' https: wss: https://data.tradingview.com https://symbol-search.tradingview.com https://*.tradingview.com wss://*.tradingview.com; frame-src 'self' https://s3.tradingview.com https://charting-library.tradingview.com https://*.tradingview.com; child-src https://*.tradingview.com; frame-ancestors 'none';",
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=(), payment=(), usb=()',
},
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
{
key: 'Cross-Origin-Resource-Policy',
value: 'same-origin',
},
{
key: 'Origin-Agent-Cluster',
value: '?1',
},
{
key: 'X-DNS-Prefetch-Control',
value: 'off',
},
{
key: 'X-Download-Options',
value: 'noopen',
},
{
key: 'X-Permitted-Cross-Domain-Policies',
value: 'none',
},
],
},
];
},
}
module.exports = nextConfig