49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
|
|
|
const { buildSecurityHeaders } = require('../../config/nextSecurityHeaders')
|
|
|
|
// The marketplace proxies /dashboard and /admin to their own Next dev servers.
|
|
// Allow those asset-prefix origins so proxied pages can load chunks and HMR.
|
|
const securityHeaders = buildSecurityHeaders({
|
|
assetSources: [process.env.DASHBOARD_ASSET_PREFIX, process.env.ADMIN_ASSET_PREFIX],
|
|
})
|
|
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
|