-
Notifications
You must be signed in to change notification settings - Fork 76
/
next.config.js
53 lines (48 loc) · 1.48 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
/** @type {import('next').NextConfig} */
const ContentSecurityPolicy = require('./csp')
const redirects = require('./redirects')
const nextConfig = {
eslint: {
ignoreDuringBuilds: true, // HYB
},
async headers() {
const headers = []
// Prevent search engines from indexing the site if it is not live
// This is useful for staging environments before they are ready to go live
// To allow robots to crawl the site, use the `NEXT_PUBLIC_IS_LIVE` env variable
// You may want to also use this variable to conditionally render any tracking scripts
if (!process.env.NEXT_PUBLIC_IS_LIVE) {
headers.push({
headers: [
{
key: 'X-Robots-Tag',
value: 'noindex',
},
],
source: '/:path*',
})
}
// Set the `Content-Security-Policy` header as a security measure to prevent XSS attacks
// It works by explicitly whitelisting trusted sources of content for your website
// This will block all inline scripts and styles except for those that are allowed
headers.push({
headers: [
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy,
},
],
source: '/(.*)',
})
return headers
},
images: {
domains: ['localhost', process.env.NEXT_PUBLIC_SERVER_URL]
.filter(Boolean)
.map((url) => url.replace(/https?:\/\//, '')),
},
reactStrictMode: true,
redirects,
swcMinify: true,
}
module.exports = nextConfig