Files
NextChair/next.config.ts
T
2026-08-03 21:15:24 +01:00

46 lines
1.9 KiB
TypeScript

import type { NextConfig } from "next";
// Static, request-independent security headers — applied to every
// response via next.config's own headers() so they can't be missed on a
// route that forgets to set them itself. Content-Security-Policy is NOT
// set here: it needs a per-request nonce (for Next's own inline
// hydration scripts), which only a request-scoped place like proxy.ts
// can generate — see that file.
const SECURITY_HEADERS = [
// This app is never meant to be framed by another origin.
{ key: "X-Frame-Options", value: "DENY" },
// Stops the browser from MIME-sniffing a response into something more
// dangerous than its declared Content-Type.
{ key: "X-Content-Type-Options", value: "nosniff" },
// Full referrer to same-origin navigations (useful for our own
// analytics-free logs), origin-only to other origins, nothing on downgrade.
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
// No page here needs the camera, microphone, geolocation, etc.
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=(), interest-cohort=()" },
// Only meaningful over HTTPS (which every real deployment of this app
// uses) — harmless to send in local HTTP dev too, since browsers only
// honor it on secure origins.
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
];
const nextConfig: NextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: "https",
hostname: "storage.googleapis.com",
pathname: "/uxpilot-auth.appspot.com/**",
},
// Google OAuth profile photos (session.user.image when signed in via
// "Continue with Google" — see src/auth.ts's Google provider).
{ protocol: "https", hostname: "lh3.googleusercontent.com" },
],
},
async headers() {
return [{ source: "/(.*)", headers: SECURITY_HEADERS }];
},
};
export default nextConfig;