64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
|
|
|
const securityHeaders = [
|
|
{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains' },
|
|
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
{ key: 'X-Frame-Options', value: 'DENY' },
|
|
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
|
|
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
|
|
{
|
|
key: 'Content-Security-Policy',
|
|
value: [
|
|
"default-src 'self'",
|
|
"script-src 'self' 'unsafe-inline'",
|
|
"style-src 'self' 'unsafe-inline'",
|
|
"img-src 'self' data: blob: https:",
|
|
"font-src 'self' data:",
|
|
"connect-src 'self' https: wss:",
|
|
"frame-ancestors 'none'",
|
|
"base-uri 'self'",
|
|
"form-action 'self'",
|
|
"object-src 'none'",
|
|
].join('; '),
|
|
},
|
|
]
|
|
const nextConfig = {
|
|
images: {
|
|
domains: ['res.cloudinary.com'],
|
|
},
|
|
transpilePackages: ['@rentaldrivego/types'],
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
headers: securityHeaders,
|
|
},
|
|
]
|
|
},
|
|
async rewrites() {
|
|
const dashboardOrigin = process.env.DASHBOARD_INTERNAL_URL ?? 'http://dashboard:3001'
|
|
const adminOrigin = process.env.ADMIN_INTERNAL_URL ?? 'http://admin:3002'
|
|
|
|
return [
|
|
{
|
|
source: '/dashboard',
|
|
destination: `${dashboardOrigin}/dashboard`,
|
|
},
|
|
{
|
|
source: '/dashboard/:path*',
|
|
destination: `${dashboardOrigin}/dashboard/:path*`,
|
|
},
|
|
{
|
|
source: '/admin',
|
|
destination: `${adminOrigin}/admin`,
|
|
},
|
|
{
|
|
source: '/admin/:path*',
|
|
destination: `${adminOrigin}/admin/:path*`,
|
|
},
|
|
]
|
|
},
|
|
}
|
|
|
|
module.exports = nextConfig
|