-
Notifications
You must be signed in to change notification settings - Fork 484
/
next.config.js
128 lines (122 loc) · 3.71 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
const IS_DEV = process.env.NODE_ENV === "development";
// IMPORTANT: Keep this in sync with netlify.toml
// prettier-ignore
const CSP_HEADER = [
"upgrade-insecure-requests;",
"frame-ancestors",
"'self'",
";",
"frame-src",
"https:",
";",
"connect-src",
"'self'",
"https://*.streamlit.app/",
"wss://*.streamlit.app/",
"https://streamlit.ghost.io/ghost/api/", // Blog API
"https://api.segment.io/", // Analytics
"https://cdn.segment.com/", // Analytics
"https://*.auryc.com/", // Analytics (Heap)
"https://www.google-analytics.com/", // Analytics
"https://stats.g.doubleclick.net/", // Analytics
"https://px.ads.linkedin.com/", // LinkedIn ad pixel
"https://*.algolia.net/", // Search
"https://*.algolianet.com/", // Search
"https://widget.kapa.ai/kapa-widget.bundle.js", // Kapa.ai
"https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app/", // Kapa.ai
"https://www.google.com/recaptcha/api.js", // Recaptcha for Kapa.ai
"https://www.gstatic.com/recaptcha/releases/", // Recaptchas for Kapa.ai
"https://www.google.com/recaptcha/enterprise.js", // Recaptchas for Kapa.ai
";",
"default-src 'none';",
"font-src 'self';",
"form-action 'self';",
"img-src",
"'self'",
"data:",
"https:",
";",
"media-src",
"'self'",
"https://s3-us-west-2.amazonaws.com/assets.streamlit.io/", // Videos
";",
"script-src",
"'self'",
"'unsafe-inline'", // NextJS payload
"'unsafe-eval'", // Required for MDXRemote in [...slug].js. Using App Router may fix this.
"https://cdn.heapanalytics.com/", // Analytics
"https://cdn.segment.com/", // Analytics
"https://www.google-analytics.com/", // Analytics
"https://www.googletagmanager.com/", // Analytics
"https://identity.netlify.com/", // Netlify dev tools
"https://netlify-cdp-loader.netlify.app/netlify.js", // Netlify dev tools
"https://www.youtube.com/iframe_api/", // YouTube Embed
"https://snap.licdn.com/", // LinkedIn ad pixel
"https://connect.facebook.net/", // Facebook ad pixel
"https://*.algolia.net/", // Search
"https://*.algolianet.com/", // Search
"https://widget.kapa.ai/kapa-widget.bundle.js", // Kapa.ai
"https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app/", // Kapa.ai
"https://www.google.com/recaptcha/api.js", // Recaptcha for Kapa.ai
"https://www.gstatic.com/recaptcha/releases/", // Recaptchas for Kapa.ai
"https://www.google.com/recaptcha/enterprise.js", // Recaptchas for Kapa.ai
";",
"style-src",
"'self'",
"'unsafe-inline'", // Twitter CSS
";",
"worker-src",
"'self'",
"blob:",
";",
];
module.exports = {
output: "export",
webpack: (configuration) => {
// Don't try to polyfill the fs module.
configuration.resolve.fallback = { fs: false };
configuration.module.rules.push(
{
test: /\.md$/,
use: "frontmatter-markdown-loader",
},
{
test: /\.svg$/,
use: ["@svgr/webpack", "file-loader"],
},
);
return configuration;
},
async exportPathMap(defaultPathMap) {
return {
...defaultPathMap,
};
},
// IMPORTANT: These headers are only useful in Dev,
// and are otherwise ignored by Netlify!
//
// On Netlify, use netlify.toml
//
// Please keep the two files in sync.
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: CSP_HEADER.join(" "),
},
{
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
],
},
];
},
};