-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
119 lines (114 loc) · 2.64 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
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
116
117
118
119
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`
});
const { createSecureHeaders } = require('next-secure-headers');
const isDev = process.env.NODE_ENV !== 'production';
(module.exports = {
reactStrictMode: true,
swcMinify: true,
webpack: function (config) {
config.module.rules.push({
test: /\.md$/,
use: 'markdown-loader'
});
return config;
},
sassOptions: {
outputStyle: 'expanded',
indentWidth: 4,
additionalData: `
@use 'styles/vars' as *;
@use 'styles/breakpoints' as *;
@use 'styles/utilities' as utils;
@use 'styles/animations' as animations;
`
},
async headers() {
const baseString = [
"'self'",
'data:',
'blob:',
'wss:',
'firebasedatabase.app',
'*.firebasedatabase.app'
];
// Default content security policy
const cspString = isDev
? [...baseString, "'unsafe-inline'", "'unsafe-eval'"]
: baseString;
// Add additional content security policy directives
const connectSrc = [
...cspString,
process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
'identitytoolkit.googleapis.com'
];
const directives = {
'default-src': cspString,
'script-src': cspString,
'style-src': cspString,
'img-src': "'self' https: data:",
'font-src': cspString,
'connect-src': connectSrc,
'frame-src': cspString,
'media-src': cspString,
'frame-ancestors': `'none'`,
'base-uri': `'none'`,
'form-action': `'none'`
};
return [
{
source: '/(.*)',
headers: createSecureHeaders({
contentSecurityPolicy: {
directives
},
forceHTTPSRedirect: [
true,
{ maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }
],
referrerPolicy: 'same-origin'
})
}
];
},
async redirects() {
return [
{
source: '/home',
destination: '/holding',
permanent: false
},
{
source: '/docs/getting-started',
destination: '/holding',
permanent: false
},
{
source: '/docs',
destination: '/holding',
permanent: false
},
{
source: '/pricing',
destination: '/holding',
permanent: false
},
{
source: '/contact',
destination: '/holding',
permanent: false
},
{
source: '/about',
destination: '/holding',
permanent: false
},
{
source: '/trade-store',
destination: '/holding',
permanent: false
}
];
}
}),
{};