-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
next.config.js
137 lines (133 loc) · 3.69 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
128
129
130
131
132
133
134
135
136
137
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */
const { createSecureHeaders } = require("next-secure-headers");
const { withContentlayer } = require("next-contentlayer2");
const port = process.env.PORT || "8080";
const hostname = process.env.HOSTNAME || `localhost`;
const domain = process.env.DOMAIN || `http://${hostname}:${port}`;
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
poweredByHeader: false,
trailingSlash: false,
productionBrowserSourceMaps: true,
swcMinify: true,
reactStrictMode: true,
env: {
DOMAIN: domain,
PORT: port,
},
eslint: {
dirs: ["src", "."],
},
logging: {
fetches: {
fullUrl: true,
},
},
async redirects() {
return [
{
source: "/about",
destination: "https://natwelch.com/wiki/about",
permanent: true,
},
{
source: "/privacy",
destination: "https://natwelch.com/wiki/privacy-policy",
permanent: true,
},
{
source: "/resume",
destination: "https://resume.natwelch.com/",
permanent: true,
},
];
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "NEL",
value: JSON.stringify({ report_to: "default", max_age: 2592000 }),
},
{
key: "Report-To",
value: JSON.stringify({
group: "default",
max_age: 10886400,
endpoints: [
{ url: `https://reportd.natwelch.com/report/natwelch` },
],
}),
},
],
},
{
source: "/(.*)",
headers: createSecureHeaders({
contentSecurityPolicy: {
directives: {
// default-src 'none'
defaultSrc: ["'none'"],
// connect-src https://graphql.natwelch.com/graphql
connectSrc: [
"https://*.natwelch.com",
domain,
domain.replace(/^https?/, "ws"),
],
// font-src 'self' https://fonts.gstatic.com
fontSrc: ["'self'", "https://fonts.gstatic.com"],
// img-src 'self' data: https://icco.imgix.net https://storage.googleapis.com
imgSrc: [
"'self'",
"data:",
"https://icco.imgix.net",
"https://storage.googleapis.com",
"https://*.natwelch.com",
],
// script-src 'self' 'unsafe-inline'
scriptSrc: [
"'self'",
"'unsafe-inline'",
"'unsafe-eval'",
"blob:",
"https://*.natwelch.com",
domain,
],
// style-src 'self' 'unsafe-inline' https://fonts.googleapis.com/
styleSrc: [
"'self'",
"'unsafe-inline'",
"https://fonts.googleapis.com/",
],
objectSrc: ["'none'"],
// https://developers.google.com/web/updates/2018/09/reportingapi#csp
reportURI: "https://reportd.natwelch.com/report/natwelch",
reportTo: "default",
},
reportOnly: true,
},
referrerPolicy: "strict-origin-when-cross-origin",
expectCT: true,
}),
},
];
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "icco.imgix.net",
port: "",
pathname: "/photos/**",
},
],
},
experimental: {
mdxRs: true,
},
};
module.exports = withContentlayer(nextConfig);