generated from DTS-STN/next-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
93 lines (91 loc) · 2.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//formatting TC Date
const builddate = process.env.BUILD_DATE
? process.env.BUILD_DATE.substring(0, 4) +
'-' +
process.env.BUILD_DATE.substring(4, 6) +
'-' +
process.env.BUILD_DATE.substring(6, 8)
: 'DATE-NA'
const securityHeaders = [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'X-XSS-Protection',
value: '0',
},
{
key: 'Content-Security-Policy',
value:
"frame-src https://www.youtube.com/; default-src 'self'; base-uri 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; script-src-elem 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:",
},
]
module.exports = {
images: {
domains: ['randomuser.me'],
},
env: {
NEXT_PUBLIC_BUILD_DATE: builddate,
LOGGING_LEVEL: process.env.LOGGING_LEVEL,
NODEMAILER_EMAIL: process.env.NODEMAILER_EMAIL,
NODEMAILER_PASSWORD: process.env.NODEMAILER_PASSWORD,
},
reactStrictMode: true,
//
// i18n setup
//
i18n: {
locales: ['en', 'fr'],
defaultLocale: 'en',
localeDetection: true,
},
// last ditch effort for ISR to work on self-hosted Next.js site
experimental: {
// Defaults to 50MB
isrMemoryCacheSize: 0,
},
//
// rewrites setup
//
// async rewrites() {
// return [
// {
// source: '/accueil',
// destination: '/home',
// },
// // {
// // source: " french page name with/without route ",
// // destination: " 'english' page ",
// // },
// ]
// },
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
]
},
}