71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const ContentSecurityPolicy = `
|
|
default-src 'self';
|
|
img-src * data: blob:;
|
|
media-src * data: blob:;
|
|
object-src 'none';
|
|
style-src 'self' 'unsafe-inline' vercel.live;
|
|
font-src 'self' vercel.live assets.vercel.com fonts.gstatic.com;
|
|
frame-src * data:;
|
|
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live challenges.cloudflare.com googletagmanager.com us-assets.i.posthog.com;
|
|
connect-src * data: blob:;
|
|
worker-src 'self' blob:;
|
|
block-all-mixed-content;
|
|
`;
|
|
|
|
const securityHeaders = [
|
|
{
|
|
key: "X-DNS-Prefetch-Control",
|
|
value: "on",
|
|
},
|
|
{
|
|
key: "X-XSS-Protection",
|
|
value: "1; mode=block",
|
|
},
|
|
{
|
|
key: "X-Frame-Options",
|
|
value: "SAMEORIGIN",
|
|
},
|
|
{
|
|
key: "Referrer-Policy",
|
|
value: "origin-when-cross-origin",
|
|
},
|
|
{
|
|
key: "Content-Security-Policy",
|
|
value: ContentSecurityPolicy.replace(/\s{2,}/g, " ").trim(),
|
|
},
|
|
];
|
|
|
|
const baseNextConfig: NextConfig = {
|
|
eslint: {
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
productionBrowserSourceMaps: false,
|
|
experimental: {
|
|
webpackBuildWorker: true,
|
|
webpackMemoryOptimizations: true,
|
|
serverSourceMaps: false,
|
|
taint: true,
|
|
},
|
|
serverExternalPackages: ["pino-pretty"],
|
|
async headers() {
|
|
return [
|
|
{
|
|
// Apply these headers to all routes in your application.
|
|
source: "/(.*)",
|
|
headers: [
|
|
...securityHeaders,
|
|
{
|
|
key: "accept-ch",
|
|
value: "sec-ch-viewport-width",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
},
|
|
reactStrictMode: true,
|
|
};
|
|
|
|
export default baseNextConfig;
|