-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
62 lines (55 loc) · 1.47 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
// Next Strict Content Security Policy
const { createSecureHeaders } = require("next-secure-headers");
const path = require("path");
const runtimeCaching = require("next-pwa/cache");
const withPWA = require("next-pwa")({
dest: "public",
disable: process.env.NODE_ENV === "development",
runtimeCaching,
});
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
domains: ["picsum.photos", "image.unsplash.com", "fruits-api.netlify.app"],
},
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH,
pwa: {
dest: "public",
register: true,
skipWaiting: true,
runtimeCaching,
},
webpack: (config) => {
config.resolve.modules.push(path.resolve("./"));
return config;
},
// new
async headers() {
return [
{
source: "/:path*",
headers: createSecureHeaders({
contentSecurityPolicy: {
directives: {
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", "data:"],
fontSrc: "'self'",
baseUri: "self",
formAction: "self",
frameAncestors: true,
},
},
forceHTTPSRedirect: [
true,
{ maxAge: 60 * 60 * 24 * 4, includeSubDomains: true },
],
referrerPolicy: "same-origin",
}),
},
];
},
};
module.exports = withPWA(nextConfig);