-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
44 lines (42 loc) · 990 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
36
37
38
39
40
41
42
43
44
require('dotenv').config();
const { createSecureHeaders } = require('next-secure-headers');
const setEnvVars = () => {
const envObj = {};
const KEYS_TO_SET = [
'APP_ENV',
'CONTENTFUL_ACCESS_TOKEN',
'CONTENTFUL_REVALIDATE_TOKEN',
'LASTFM_API_KEY',
'LASTFM_USERNAME',
'HOLDING_MODE',
];
for (let key in process.env) {
if (KEYS_TO_SET.includes(key)) envObj[key] = process.env[key];
}
return envObj;
};
module.exports = {
env: setEnvVars(),
webpack(config) {
config.module.rules.push({
test: /\.(jpe?g|png|gif|svg)$/i,
use: ['url-loader?limit=10000', 'img-loader'],
});
config.resolve.fallback = { fs: false };
return config;
},
poweredByHeader: false,
async headers() {
return [
{
source: '/(.*)',
headers: createSecureHeaders({
// forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }],
referrerPolicy: 'same-origin',
frameGuard: 'deny',
xssProtection: 'sanitize',
}),
},
];
},
};