66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import path from "path";
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
images: { unoptimized: true },
|
|
serverExternalPackages: ["better-sqlite3"],
|
|
allowedDevOrigins: ["nonmonarchial-glisky-suzann.ngrok-free.dev"],
|
|
trailingSlash: false,
|
|
// Pin the Turbopack workspace root to THIS project. A stray
|
|
// package-lock.json in ~/Documents/GitHub made Turbopack infer the parent
|
|
// folder as the root, so the dev file-watcher tried to index ~40 sibling
|
|
// repos and all their node_modules (200k+ files) — that's what froze the
|
|
// Mac. Pinning the root keeps watching scoped to this repo.
|
|
turbopack: {
|
|
root: path.join(__dirname),
|
|
},
|
|
// Expose the deployed build's git SHA so the deploy pipeline can confirm
|
|
// the new container is live at the origin before purging the CDN cache.
|
|
// Baked in at build time from the GIT_SHA env (see Dockerfile / deploy.yml).
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/sw.js",
|
|
headers: [
|
|
{ key: "Content-Type", value: "application/javascript; charset=utf-8" },
|
|
{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" },
|
|
],
|
|
},
|
|
{
|
|
source: "/login",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" },
|
|
{ key: "Clear-Site-Data", value: '"cache", "storage"' },
|
|
],
|
|
},
|
|
{
|
|
// Media must NOT be gzip/brotli-compressed: a compressed stream can't be
|
|
// byte-range-served, so the CDN returns 200 (whole file) instead of 206
|
|
// and Safari refuses to play <video> (stalls after buffering the head).
|
|
// `no-transform` tells Cloudflare & any conforming proxy to leave it
|
|
// alone so range requests keep working. See docs/deployment.md (prod is
|
|
// behind Cloudflare; staging is direct and already serves 206).
|
|
source: "/videos/:path*",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "public, max-age=14400, no-transform" },
|
|
],
|
|
},
|
|
{
|
|
source: "/:path*",
|
|
headers: [
|
|
{ key: "X-Build-SHA", value: process.env.GIT_SHA ?? "dev" },
|
|
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
|
|
{ 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=(), interest-cohort=()" },
|
|
{ key: "X-DNS-Prefetch-Control", value: "on" },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|