Files
carmanagement/apps/homepage/next.config.ts
T
root 56c3bcf666
Build & Deploy / Build & Push Docker Image (push) Successful in 2m50s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 3s
Test / API Unit Tests (push) Successful in 54s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Storefront Unit Tests (push) Successful in 41s
Test / Admin Unit Tests (push) Successful in 42s
Test / Dashboard Unit Tests (push) Successful in 41s
Test / API Integration Tests (push) Successful in 1m0s
fix homepage storefront proxy and CSP
2026-07-02 13:55:10 -04:00

90 lines
2.1 KiB
TypeScript

import type { NextConfig } from 'next';
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=()' },
];
const nextConfig: NextConfig = {
allowedDevOrigins: ['192.168.3.3'],
compress: true,
poweredByHeader: false,
reactStrictMode: true,
transpilePackages: ['@rentaldrivego/types'],
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'res.cloudinary.com',
},
],
},
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
];
},
async redirects() {
return [
{
source: '/dashboard/dashboard',
destination: '/dashboard',
permanent: false,
},
{
source: '/dashboard/dashboard/:path*',
destination: '/dashboard/:path*',
permanent: false,
},
];
},
async rewrites() {
const dashboardOrigin =
process.env.DASHBOARD_INTERNAL_URL ?? 'http://dashboard:3001';
const adminOrigin =
process.env.ADMIN_INTERNAL_URL ?? 'http://admin:3002';
const storefrontOrigin =
process.env.STOREFRONT_INTERNAL_URL ?? 'http://storefront:3004';
return [
{
source: '/storefront',
destination: `${storefrontOrigin}`,
},
{
source: '/storefront/:path*',
destination: `${storefrontOrigin}/:path*`,
},
{
source: '/dashboard',
destination: `${dashboardOrigin}/dashboard`,
},
{
source: '/dashboard/:path*',
destination: `${dashboardOrigin}/dashboard/:path*`,
},
{
source: '/admin',
destination: `${adminOrigin}/admin`,
},
{
source: '/admin/:path*',
destination: `${adminOrigin}/admin/:path*`,
},
];
},
};
export default nextConfig;