yufan.me/next.config.mjs
2024-06-14 02:13:47 +08:00

49 lines
947 B
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
minimumCacheTTL: 3600,
dangerouslyAllowSVG: false,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
unoptimized: false,
},
pageExtensions: ['js', 'jsx', 'ts', 'tsx'],
reactStrictMode: true,
headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
];
},
};
const securityHeaders = [
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
];
export default nextConfig;