Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
36 lines (33 loc) · 1.74 KB
/
Copy pathnext.config.ts
File metadata and controls
36 lines (33 loc) · 1.74 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
import { assertSelfHostEnvironment } from "./bin/selfhost-guard.mjs";
assertSelfHostEnvironment();
import type { NextConfig } from "next";
/** Applied to every response. Script sources are not restricted yet: that needs a per-request
nonce, which forces dynamic rendering. frame-ancestors blocks clickjacking now. */
const securityHeaders = [
{ key: "Content-Security-Policy", value: "frame-ancestors 'none'; object-src 'none'; base-uri 'self'" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
// Browsers ignore HSTS on plain HTTP, so localhost and LAN testing are not affected.
{ key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
];
const nextConfig: NextConfig = {
async headers() {
return [{ source: "/:path*", headers: securityHeaders }];
},
// OAuth callback URLs contain one-time codes. Never write request URLs to dev logs.
logging: { incomingRequests: false },
cacheComponents: true,
partialPrefetching: true,
// Codespace tunnel stack (lib/github/codespace-tunnel.ts). These packages use optional
// requires (node-rsa, cpu-features) and native Node APIs, so load them with plain require.
// GET /v1/cli serves this file; a traced deployment must contain it.
outputFileTracingIncludes: { "/v1/cli": ["./bin/emuly.mjs"] },
serverExternalPackages: [
"@microsoft/dev-tunnels-connections", "@microsoft/dev-tunnels-management",
"@microsoft/dev-tunnels-contracts", "@microsoft/dev-tunnels-ssh", "@microsoft/dev-tunnels-ssh-tcp",
"@grpc/grpc-js", "ssh2",
],
};
export default nextConfig;