-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.mjs
More file actions
64 lines (62 loc) · 1.34 KB
/
next.config.mjs
File metadata and controls
64 lines (62 loc) · 1.34 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
// @ts-check
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds.
*/
!process.env.SKIP_ENV_VALIDATION && (await import('./src/env/server.mjs'));
// Cool Security Headers.
const securityHeaders = [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Frame-Options', // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options', // Block the browser from trying to guess the MIME type.
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin', // https://scotthelme.co.uk/a-new-security-header-referrer-policy/
},
];
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
swcMinify: true,
i18n: {
locales: ['en'],
defaultLocale: 'en',
},
async headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
];
},
async redirects() {
return [
{
source: '/',
has: [
{
type: 'cookie',
key: 'token',
},
],
permanent: false,
destination: '/app',
},
];
},
};
export default config;