Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions web/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
import type { NextConfig } from "next";

const apiOrigin = (() => {
try {
return new URL(
process.env.NEXT_PUBLIC_API_URL ?? "http://127.0.0.1:8000",
).origin;
} catch {
return "http://127.0.0.1:8000";
}
})();

const csp = [
"default-src 'self'",
"script-src 'self' 'unsafe-inline'",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: https:",
"font-src 'self' data:",
`connect-src 'self' ${apiOrigin} https://*.supabase.co`,
"frame-ancestors 'none'",
].join("; ");

const securityHeaders = [
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-Content-Type-Options", value: "nosniff" },
Expand All @@ -12,11 +32,7 @@ const securityHeaders = [
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains",
},
{
key: "Content-Security-Policy-Report-Only",
value:
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https://lysis-3ocq.onrender.com https://*.supabase.co; frame-ancestors 'none'",
},
{ key: "Content-Security-Policy", value: csp },
];

const nextConfig: NextConfig = {
Expand All @@ -35,4 +51,4 @@ const nextConfig: NextConfig = {
},
};

export default nextConfig;
export default nextConfig;
Loading