90 lines
2.0 KiB
TypeScript
90 lines
2.0 KiB
TypeScript
|
|
import type { NextConfig } from 'next'
|
||
|
|
|
||
|
|
const securityHeaders = [
|
||
|
|
{
|
||
|
|
key: 'X-DNS-Prefetch-Control',
|
||
|
|
value: 'on',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'Strict-Transport-Security',
|
||
|
|
value: 'max-age=63072000; includeSubDomains; preload',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'X-Content-Type-Options',
|
||
|
|
value: 'nosniff',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'X-Frame-Options',
|
||
|
|
value: 'SAMEORIGIN',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'X-XSS-Protection',
|
||
|
|
value: '1; mode=block',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
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'",
|
||
|
|
"img-src 'self' data: blob: https://*.letsbe.solutions",
|
||
|
|
"font-src 'self' data:",
|
||
|
|
"connect-src 'self' https://*.letsbe.solutions",
|
||
|
|
"frame-ancestors 'self'",
|
||
|
|
"base-uri 'self'",
|
||
|
|
"form-action 'self'",
|
||
|
|
].join('; '),
|
||
|
|
},
|
||
|
|
]
|
||
|
|
|
||
|
|
const nextConfig: NextConfig = {
|
||
|
|
output: 'standalone',
|
||
|
|
// reactCompiler: true, // Requires babel-plugin-react-compiler - enable later
|
||
|
|
experimental: {
|
||
|
|
serverActions: {
|
||
|
|
bodySizeLimit: '2mb',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
images: {
|
||
|
|
remotePatterns: [
|
||
|
|
{
|
||
|
|
protocol: 'https',
|
||
|
|
hostname: '*.letsbe.solutions',
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
// Turbopack config (Next.js 16 default bundler)
|
||
|
|
turbopack: {},
|
||
|
|
// Handle native modules like ssh2 (for webpack fallback)
|
||
|
|
webpack: (config, { isServer }) => {
|
||
|
|
if (isServer) {
|
||
|
|
// Externalize ssh2 and its native dependencies
|
||
|
|
config.externals = config.externals || []
|
||
|
|
config.externals.push({
|
||
|
|
'ssh2': 'commonjs ssh2',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
return config
|
||
|
|
},
|
||
|
|
// Externalize ssh2 for both Turbopack and Webpack
|
||
|
|
serverExternalPackages: ['ssh2'],
|
||
|
|
async headers() {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
source: '/(.*)',
|
||
|
|
headers: securityHeaders,
|
||
|
|
},
|
||
|
|
]
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
export default nextConfig
|