generated from DTS-STN/next-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
127 lines (122 loc) · 3.32 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// @ts-check
const REWRITES = [
{
source: '/contactez-nous',
destination: '/contact-us',
},
{
source: '/mon-tableau-de-bord',
destination: '/my-dashboard',
},
{
source: '/profil',
destination: '/profile',
},
{
source: '/parametres-securite',
destination: '/security-settings',
},
{
source: '/contactez-nous/communiquer-assurance-emploi',
destination: '/contact-us/contact-employment-insurance',
},
{
source: '/contactez-nous/communiquer-securite-vieillesse',
destination: '/contact-us/contact-old-age-security',
},
{
source: '/contactez-nous/communiquer-regime-pensions-canada',
destination: '/contact-us/contact-canada-pension-plan',
},
{
source: '/demande-revision',
destination: '/decision-reviews',
},
]
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:
"default-src 'self' *.omtrdc.net *.2o7.net https://assets.adobedtm.com; base-uri 'self'; frame-ancestors 'self'; form-action 'self' https://srv113-i.lab.hrdc-drhc.gc.ca; object-src 'none'; script-src-elem 'self' 'unsafe-inline' https://assets.adobedtm.com; script-src 'self' 'unsafe-eval' https://*.demdex.net https://cm.everesttech.net https://assets.adobedtm.com *.omtrdc.net *.2o7.net; connect-src 'self' https://*.demdex.net https://cm.everesttech.net https://assets.adobedtm.com *.omtrdc.net *.2o7.net https://srv241-s2.lab.hrdc-drhc.gc.ca; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; frame-src 'self' https://*.demdex.net *.omtrdc.net *.2o7.net https://assets.adobedtm.com; img-src 'self' data: https: https://*.demdex.net https://cm.everesttech.net https://assets.adobedtm.com *.omtrdc.net *.2o7.net;",
},
]
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
publicRuntimeConfig: {
LOGGING_LEVEL: process.env.LOGGING_LEVEL ?? 'info',
ENVIRONMENT: process.env.ENVIRONMENT,
},
eslint: {
dirs: ['.'], //or ['pages', 'hooks']
},
reactStrictMode: true,
//
// i18n setup
//
i18n: {
locales: ['und', 'en', 'fr'],
defaultLocale: 'und',
localeDetection: false,
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
//GraphQL loader for .graphql files
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
})
return config
},
//disable X-Powered-By
poweredByHeader: false,
// Image configured host
images: {
domains: ['www.canada.ca'],
},
experimental: {
instrumentationHook: true,
},
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
]
},
//Redirect French URLs
async rewrites() {
return REWRITES
},
}
module.exports = nextConfig