-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathnext.config.ts
More file actions
63 lines (60 loc) · 1.78 KB
/
Copy pathnext.config.ts
File metadata and controls
63 lines (60 loc) · 1.78 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
import type { NextConfig } from "next";
// URL_BASE_PATH must be set at build time (via Docker --build-arg) so that
// Next.js can bake the correct prefix into /_next/static asset URLs.
// At runtime, the proxy (src/proxy.ts) strips this prefix from incoming
// requests so internal Next.js routes remain at their canonical paths.
const BASE_PATH = (() => {
const raw = process.env.URL_BASE_PATH ?? "";
const stripped = raw.replace(/\/$/, "");
return stripped && !stripped.startsWith("/") ? `/${stripped}` : stripped;
})();
const nextConfig: NextConfig = {
reactCompiler: true,
cacheComponents: true,
output: "standalone",
assetPrefix: BASE_PATH || undefined,
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=()",
},
// Content-Security-Policy is set at runtime in proxy.ts (middleware)
// so it can read CSP_FRAME_ANCESTORS from Docker runtime env vars.
// next.config.ts headers() runs AFTER middleware in Next.js and would
// overwrite the runtime CSP, so it is intentionally omitted here.
],
},
];
},
images: {
unoptimized: false,
formats: ["image/avif", "image/webp"],
remotePatterns: [
{
protocol: "http",
hostname: "**",
},
{
protocol: "https",
hostname: "**",
},
],
},
};
export default nextConfig;