summaryrefslogtreecommitdiff
path: root/apps/web/next.config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/next.config.ts')
-rw-r--r--apps/web/next.config.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
new file mode 100644
index 0000000..f580efd
--- /dev/null
+++ b/apps/web/next.config.ts
@@ -0,0 +1,54 @@
+import withSerwistInit from "@serwist/next"
+import type { NextConfig } from "next"
+
+const withSerwist = withSerwistInit({
+ swSrc: "app/sw.ts",
+ swDest: "public/sw.js",
+ disable: process.env.NODE_ENV === "development",
+})
+
+const securityHeaders = [
+ { key: "X-Frame-Options", value: "DENY" },
+ { key: "X-Content-Type-Options", value: "nosniff" },
+ { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
+ {
+ key: "Permissions-Policy",
+ value: "camera=(), microphone=(), geolocation=()",
+ },
+ {
+ key: "Strict-Transport-Security",
+ value: "max-age=63072000; includeSubDomains; preload",
+ },
+ {
+ key: "Content-Security-Policy",
+ value: [
+ "default-src 'self'",
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://va.vercel-scripts.com",
+ "style-src 'self' 'unsafe-inline'",
+ "img-src 'self' data: https: http:",
+ "font-src 'self'",
+ "connect-src 'self' https://*.supabase.co wss://*.supabase.co https://api.stripe.com",
+ "frame-src https://js.stripe.com https://hooks.stripe.com",
+ "media-src 'self' https: http:",
+ "object-src 'none'",
+ "base-uri 'self'",
+ "form-action 'self'",
+ "frame-ancestors 'none'",
+ ].join("; "),
+ },
+]
+
+const nextConfig: NextConfig = {
+ reactCompiler: true,
+ turbopack: {},
+ async headers() {
+ return [
+ {
+ source: "/(.*)",
+ headers: securityHeaders,
+ },
+ ]
+ },
+}
+
+export default withSerwist(nextConfig)