/
next.config.js
53 lines (52 loc) · 1.46 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
// https://nextjs.org/docs/advanced-features/security-headers
const securityHeaders = [
{
key: 'X-DNS-Prefetch-Control', // Allows browsers to prefetch external links/images/etc. Reduces latency when a user clicks
value: 'on'
},
{
key: 'X-XSS-Protection', // Legacy protection against XSS attacks
value: '1; mode=block'
},
{
key: 'X-Frame-Options', // Prevents click hijacking via iframes, could use frame-ancestors in CSP
value: 'SAMEORIGIN'
},
// {
// key: 'Permissions-Policy', // Controls what APIs can be controlled Todo: Look into this
// value: 'camera=(), microphone=(), geolocate=()'
// },
{
key: 'X-Content-Type-Options', // Controls whether the content type can be inferred // Todo: look into this
value: 'nosniff'
},
{
key: 'Referrer-Policy', // Controls information communicated to other origins. // Todo: look into this
value: 'origin-when-cross-origin'
},
{
key: 'Content-Security-Policy', // Protects against XSS
value: '' // Todo: Add
},
];
const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx'],
webpack: (config, { dev, isServer }) => {
require('./utilities/generateRSS');
return config;
},
i18n: {
locales: ["en"],
defaultLocale: "en",
},
async headers() {
return [
{
// Apply these headers to all routes in the application.
source: '/(.*)',
headers: securityHeaders,
},
]
},
};
module.exports = nextConfig;