-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
54 lines (53 loc) · 1.5 KB
/
Copy pathnext.config.js
File metadata and controls
54 lines (53 loc) · 1.5 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Remove X-Powered-By header for security and SEO best practices
poweredByHeader: false,
// Enable gzip/brotli compression on all responses
compress: true,
eslint: {
ignoreDuringBuilds: true,
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
},
],
},
async headers() {
return [
{
// Cache static assets for 1 year (they're content-hashed by Next.js)
source: '/_next/static/(.*)',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
],
},
{
// Cache optimized images for 7 days
source: '/_next/image(.*)',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=604800, stale-while-revalidate=86400' },
],
},
{
// Cache public assets (favicon, etc.) for 1 day
source: '/(favicon\\.svg|favicon\\.ico|robots\\.txt|sitemap\\.xml)',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=86400' },
],
},
{
// Security + SEO trust headers on all routes
source: '/(.*)',
headers: [
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
],
},
];
},
};
module.exports = nextConfig;