-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
77 lines (70 loc) · 2.88 KB
/
next.config.ts
File metadata and controls
77 lines (70 loc) · 2.88 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
import type { NextConfig } from 'next';
// Conditional bundle analyzer import
const withBundleAnalyzer =
process.env.ANALYZE === 'true'
? // eslint-disable-next-line @typescript-eslint/no-require-imports
require('@next/bundle-analyzer')({ enabled: true })
: (config: NextConfig) => config;
const nextConfig: NextConfig = {
// Enable static exports for better performance
// output: 'export', // Uncomment if you want static export
// Image optimization configuration
images: {
formats: ['image/webp', 'image/avif'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
// Enable compression
compress: true,
// Headers for CSP - allow LinkedIn scripts, Google Fonts, and Google reCAPTCHA
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://platform.linkedin.com https://badges.linkedin.com https://www.google.com https://www.gstatic.com https://www.recaptcha.net https://recaptcha.google.com https://www.googletagmanager.com",
"connect-src 'self' https://platform.linkedin.com https://www.linkedin.com https://badges.linkedin.com https://www.google.com https://www.gstatic.com https://www.recaptcha.net https://recaptcha.google.com https://www.googletagmanager.com",
"frame-src 'self' https://www.google.com https://www.gstatic.com https://www.recaptcha.net https://recaptcha.google.com",
"child-src 'self' https://www.google.com https://www.recaptcha.net https://recaptcha.google.com",
"img-src 'self' data: https://media.licdn.com https://cdn.jsdelivr.net https://www.google.com https://www.gstatic.com https://www.recaptcha.net",
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://www.google.com https://www.gstatic.com",
"font-src 'self' data: https://fonts.gstatic.com",
].join('; '),
},
{
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: 'origin-when-cross-origin',
},
],
},
];
},
// Rewrites for better SEO and well-known URI handling
async rewrites() {
return [
{
source: '/.well-known/security.txt',
destination: '/api/well-known/security',
},
];
},
};
export default withBundleAnalyzer(nextConfig);