-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
68 lines (64 loc) · 2.06 KB
/
Copy pathnext.config.ts
File metadata and controls
68 lines (64 loc) · 2.06 KB
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
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
const withNextIntl = createNextIntlPlugin("./i18n/request.ts");
const nextConfig: NextConfig = {
// Cloudflare Workers (Edge Runtime) 向け設定
output: "standalone",
typescript: {
ignoreBuildErrors: true,
},
experimental: {
optimizePackageImports: ["@mui/icons-material", "@mui/material"],
},
images: {
// GitHub アバター & R2 ファイルを許可
remotePatterns: [
{
protocol: "https",
hostname: "avatars.githubusercontent.com",
},
{
protocol: "https",
hostname: "*.r2.cloudflarestorage.com",
},
{
protocol: "https",
hostname: "files.modparks.dev",
},
],
},
webpack: (config) => {
config.resolve.symlinks = false;
return config;
},
async headers() {
// MUI(emotion)のinline styleとNext.jsのinline scriptを壊さないため、
// script/styleは 'unsafe-inline' を許容した最低限のCSPに留める
const csp = [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://static.cloudflareinsights.com",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: https:",
"font-src 'self' data:",
"connect-src 'self' https:",
"frame-src https://www.youtube.com https://www.youtube-nocookie.com",
"object-src 'none'",
"base-uri 'self'",
"form-action 'self'",
].join("; ");
return [
{
source: "/(.*)",
headers: [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
{ key: "Content-Security-Policy", value: csp },
],
},
];
},
};
export default withNextIntl(nextConfig);