-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
executable file
·48 lines (45 loc) · 1.03 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
/** @type {import('next').NextConfig} */
const ONE_YEAR_SECONDS = 60 * 60 * 24 * 365;
const CACHE_CONTROL_HEADER = {
key: "Cache-Control",
value: `public, max-age=${ONE_YEAR_SECONDS}, immutable`,
};
const ContentSecurityPolicy = `
default-src * 'unsafe-inline' 'unsafe-eval';
script-src * 'unsafe-inline' 'unsafe-eval';
connect-src * 'unsafe-inline';
img-src * data: blob: 'unsafe-inline';
frame-src *;
style-src * 'unsafe-inline';
`;
const SECURITY_HEADERS = [
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "Content-Security-Policy",
value: ContentSecurityPolicy.replace(/\s{2,}/g, " ").trim(),
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
];
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
headers: async () => {
return [
{
source: "/:path*",
headers: SECURITY_HEADERS,
},
{
source: "/img/:path*",
headers: [CACHE_CONTROL_HEADER],
},
];
},
};
module.exports = nextConfig;