-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
115 lines (111 loc) · 3.6 KB
/
next.config.js
File metadata and controls
115 lines (111 loc) · 3.6 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
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
module.exports = (phase, { defaultConfig }) => {
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
return {
...defaultConfig,
reactStrictMode: true,
serverRuntimeConfig: {
programmerEmail: 'justin@jjwilly.com',
},
publicRuntimeConfig: {},
async headers() {
if (!isDev) {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: Object.entries({
// If a directive is missing, the rule will fall back to default-src
'default-src': [
"'self'",
],
// Valid sources for loading javascript
'script-src': [
"'self'",
],
// Valid sources for loading stylesheets
'style-src': [
"'self'",
"'unsafe-inline'",
// Needed for loading google fonts in scss
'https://fonts.googleapis.com',
],
// Valid sources for loading fonts
'font-src': [
"'self'",
// Google font loading
'https://fonts.gstatic.com',
],
// Valid sources for URLs loaded in scripts
'connect-src': [
"'self'",
// Needed for local livereload server
'ws:',
'wss:',
// Vercel analytics
'vitals.vercel-insights.com',
],
// Valid sources for images
'img-src': [
"'self'",
// Allow data URIs
'data:',
// Allow blobs
'blob:',
],
// Valid sources for object tags
'object-src': [
"'none'",
],
// Valid sources for the <base> tag in the header
'base-uri': [
"'self'",
],
// Valid sources for iframes
'frame-src': [
"'none'",
],
// Valid parents for iframes
'frame-ancestors': [
"'none'",
],
// Upgrade http requests to https
'upgrade-insecure-requests': !isDev,
})
.reduce((arr, [key, value]) => {
const parsedValue = Array.isArray(value) ? value.join(' ') : value;
if (value) arr.push(`${key}${typeof parsedValue === 'string' ? ` ${parsedValue}` : ''}`);
return arr;
}, [])
.join('; '),
},
{
key: 'X-DNS-Prefetch-Control',
value: 'on'
},
{
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin'
},
]
}
];
}
return [];
},
}
}