mirror of
https://github.com/Twigpine/openlaunch.git
synced 2026-11-10 13:11:33 -10:00
Every page now carries a per-request Content-Security-Policy. The proxy mints a nonce, Next.js stamps it on its inline scripts, and the root layout forwards it to next-themes. Scripts run only with the nonce plus strict-dynamic; framing is denied; connect-src covers the site and the Coinbase Wallet SDK endpoints; images allow https because token logos are user-supplied URLs validated server-side. Static headers (nosniff, X-Frame-Options, Referrer-Policy, Permissions-Policy, HSTS) apply to every route from next.config.ts. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GkReG2zjRq3Ts7YqdgjaaJ
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import { SECURITY_HEADERS } from "./src/lib/security-headers";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Fly: the Dockerfile copies .next/standalone (server.js + traced node_modules).
|
|
output: "standalone",
|
|
// Keep the Postgres driver external (not bundled) so it is traced into
|
|
// .next/standalone/node_modules and scripts/migrate.mjs can import it inside
|
|
// the image (release_command runs there, outside the Next server).
|
|
serverExternalPackages: ["postgres"],
|
|
async headers() {
|
|
return [
|
|
{
|
|
// Static security headers on everything; the per-request CSP is set in src/proxy.ts.
|
|
source: "/(.*)",
|
|
headers: [...SECURITY_HEADERS],
|
|
},
|
|
{
|
|
// The JSON API is the agent surface; never let a CDN cache a stale list.
|
|
source: "/api/:path*",
|
|
headers: [{ key: "cache-control", value: "no-store" }],
|
|
},
|
|
{
|
|
// stored token logos: random immutable keys → cache hard (overrides the /api no-store above)
|
|
source: "/api/launch/image/t/:key*",
|
|
headers: [{ key: "cache-control", value: "public, max-age=31536000, immutable" }],
|
|
},
|
|
{
|
|
source: "/llms.txt",
|
|
headers: [{ key: "cache-control", value: "public, max-age=300" }],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|