-
Notifications
You must be signed in to change notification settings - Fork 7
/
next.config.js
80 lines (78 loc) · 2.38 KB
/
next.config.js
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
const contentSecurityPolicy = `
default-src 'self' https://*.googletagmanager.com https://*.google-analytics.com https://*.analytics.google.com https://*.vercel-insights.com https://vercel.live https://mateonunez.dev/;
base-uri 'self';
block-all-mixed-content;
connect-src 'self' https://*.googletagmanager.com https://*.google-analytics.com https://*.analytics.google.com https://*.vercel-insights.com https://vercel.live https://mateonunez.dev/;
font-src 'self' https://fonts.gstatic.com https://*.vercel.com https://vercel.live;
frame-ancestors 'self';
img-src 'self' data: https://i.scdn.co https://avatars.githubusercontent.com https://*.googletagmanager.com https://*.google-analytics.com https://*.vercel.com https://*.vercel-insights.com https://vercel.live https://*.google.com https://*.google.it https://*.githubassets.com https://*.githubusercontent.com https://*.github.com https://*.gstatic.com;
object-src 'none';
script-src 'self' 'unsafe-eval' 'unsafe-inline' https://*.googletagmanager.com https://*.google-analytics.com https://*.vercel-insights.com https://vercel.live https://*.vercel-scripts.com;
script-src-attr 'none';
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com
`;
// Security Headers
const securityHeaders = [
// Content Security Policy
{
key: 'Content-Security-Policy',
value: contentSecurityPolicy.replace(/\s{2,}/g, ' ').trim(),
},
// XSS Protection
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
// No Sniff
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
// Force HTTPS
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
// Referrer Policy
{
key: 'Referrer-Policy',
value: 'same-origin',
},
// Frame Options
{
key: 'X-Frame-Options',
value: 'DENY',
},
];
module.exports = {
reactStrictMode: true,
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [
{
protocol: 'https',
hostname: '**.scdn.co',
},
{
protocol: 'https',
hostname: '**.githubusercontent.com',
},
{
protocol: 'https',
hostname: '**.githubassets.com',
},
],
minimumCacheTTL: 60,
},
headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
];
},
eslint: {
ignoreDuringBuilds: true,
},
};