-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
64 lines (59 loc) · 1.65 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
54
55
56
57
58
59
60
61
62
63
64
/** @type {import('next').NextConfig} */
const ContentSecurityPolicy = require('./csp')
const redirects = require('./redirects')
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'society.ecs.soton.ac.uk',
},
{
protocol: 'https',
hostname: process.env.NEXT_PUBLIC_SERVER_URL,
},
{
protocol: 'http',
hostname: 'localhost',
},
],
},
redirects,
eslint: {
ignoreDuringBuilds: true,
},
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({
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy,
},
],
})
return headers
},
}
module.exports = nextConfig