-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathnext.config.ts
More file actions
79 lines (72 loc) · 2.69 KB
/
next.config.ts
File metadata and controls
79 lines (72 loc) · 2.69 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
// Copyright (c) Helio Chissini de Castro, 2023. Part of the SW360 Frontend Project.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
// SPDX-License-Identifier: EPL-2.0
// License-Filename: LICENSE
import { NextConfig } from 'next'
import createNextIntlPlugin from 'next-intl/plugin'
const withNextIntl = createNextIntlPlugin()
const isDev = process.env.NODE_ENV === 'development'
const csp = `
default-src 'self';
script-src 'self' 'unsafe-eval' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
img-src 'self' data: https:;
font-src 'self' data:;
connect-src 'self' https:${isDev ? ' http://localhost:8080' : ''};
`.replace(/\s{2,}/g, ' ').trim()
const config: NextConfig = {
productionBrowserSourceMaps: true,
reactStrictMode: true,
output: 'standalone',
typescript: {
ignoreBuildErrors: false,
},
async headers() {
return [
{
// Apply security headers to all routes
source: '/:path*',
headers: [
{
// HTTP Strict Transport Security (HSTS) - RFC 6797
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
{
// Prevent MIME type sniffing
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
// Enable XSS protection
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
// Control how much referrer information should be included
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
// Prevent clickjacking attacks
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
// Content Security Policy
key: 'Content-Security-Policy',
value: csp,
},
{
// Permissions Policy (formerly Feature-Policy)
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
],
},
]
},
}
export default withNextIntl(config)