-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
47 lines (44 loc) · 1.25 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
const isDevelopment = process.env.NODE_ENV === 'development';
/** @type {import('next').NextConfig} */
export default {
experimental: {
optimizePackageImports: ['@navikt/ds-react', '@navikt/aksel-icons'],
},
output: 'standalone',
async headers() {
const ContentSecurityPolicy = `
default-src 'self';
script-src 'self' ${isDevelopment ? "'unsafe-eval'" : ''};
style-src 'self' 'unsafe-inline';
font-src 'self' cdn.nav.no;
`;
const securityHeaders = [
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim(),
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'no-referrer',
},
];
return [
{
source: '/:path*',
headers: securityHeaders,
},
];
},
};