-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
35 lines (31 loc) · 885 Bytes
/
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
const withBundleAnalyzer =
process.env.BUNDLE_ANALYZE === 'true' ? require('@next/bundle-analyzer')({ enabled: true }) : (config) => config;
const headers = [
{
key: 'Surrogate-Control',
value: 'content="ESI/1.0"',
},
{
key: 'Access-Control-Allow-Origin',
value: process.env.HEADERS_CORS || '*',
}
];
headers.push({
key: 'Access-Control-Allow-Headers',
value: ['Accept', 'Origin', 'Content-Type', `X-Requested-With`, ...headers.map((h) => h.key)].join(', '),
});
const configuration = {
trailingSlash: true,
compress: process.env.GZIP_COMPRESSION === 'true',
poweredByHeader: false,
generateEtags: true,
async headers() {
return [
{
source: '/',
headers,
},
];
},
};
module.exports = () => withBundleAnalyzer(configuration);