77 lines
1.8 KiB
JavaScript
77 lines
1.8 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
reactStrictMode: true,
|
|
swcMinify: true,
|
|
output: 'standalone',
|
|
eslint: {
|
|
ignoreDuringBuilds: true
|
|
},
|
|
redirects: async () => {
|
|
return [
|
|
{
|
|
source: '/',
|
|
destination: '/sign-in',
|
|
permanent: true
|
|
}
|
|
];
|
|
},
|
|
headers: async () => {
|
|
return [
|
|
{
|
|
source: '/(.*)',
|
|
headers: securityHeaders
|
|
}
|
|
];
|
|
}
|
|
};
|
|
|
|
// https://nextjs.org/docs/advanced-features/security-headers
|
|
const ContentSecurityPolicy = `
|
|
default-src 'self';
|
|
script-src 'self' 'unsafe-eval' 'unsafe-inline';
|
|
style-src 'self' 'unsafe-inline';
|
|
img-src * blob: data:;
|
|
media-src 'none';
|
|
connect-src *;
|
|
font-src 'self' data:;
|
|
`;
|
|
|
|
const securityHeaders = [
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
|
{
|
|
key: 'Content-Security-Policy',
|
|
value: ContentSecurityPolicy.replace(/\n/g, '')
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
|
|
{
|
|
key: 'Referrer-Policy',
|
|
value: 'origin-when-cross-origin'
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
|
|
{
|
|
key: 'X-Frame-Options',
|
|
value: 'DENY'
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
|
|
{
|
|
key: 'X-Content-Type-Options',
|
|
value: 'nosniff'
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
|
|
{
|
|
key: 'X-DNS-Prefetch-Control',
|
|
value: 'on'
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
|
|
{
|
|
key: 'Strict-Transport-Security',
|
|
value: 'max-age=31536000; includeSubDomains; preload'
|
|
},
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
|
|
{
|
|
key: 'Permissions-Policy',
|
|
value: 'camera=(), microphone=(), geolocation=()'
|
|
}
|
|
];
|
|
|
|
module.exports = nextConfig;
|