This commit is contained in:
Iliyan Angelov
2025-11-25 02:06:38 +02:00
parent 2f6dca736a
commit 82024016cd
37 changed files with 1800 additions and 1478 deletions

View File

@@ -1,8 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// Enable standalone output for Docker
// Enable standalone output for optimized production deployment
output: 'standalone',
images: {
// Enable image optimization in standalone mode
unoptimized: false,
remotePatterns: [
{
protocol: 'http',
@@ -33,15 +35,60 @@ const nextConfig = {
hostname: 'images.unsplash.com',
pathname: '/**',
},
// Add your production domain when ready
// {
// protocol: 'https',
// hostname: 'your-api-domain.com',
// pathname: '/media/**',
// },
// Production domain configuration
{
protocol: 'https',
hostname: 'gnxsoft.com',
pathname: '/media/**',
},
{
protocol: 'https',
hostname: 'gnxsoft.com',
pathname: '/images/**',
},
{
protocol: 'https',
hostname: 'gnxsoft.com',
pathname: '/_next/static/**',
},
{
protocol: 'http',
hostname: 'gnxsoft.com',
pathname: '/media/**',
},
{
protocol: 'http',
hostname: 'gnxsoft.com',
pathname: '/images/**',
},
{
protocol: 'https',
hostname: 'www.gnxsoft.com',
pathname: '/media/**',
},
{
protocol: 'https',
hostname: 'www.gnxsoft.com',
pathname: '/images/**',
},
{
protocol: 'https',
hostname: 'www.gnxsoft.com',
pathname: '/_next/static/**',
},
{
protocol: 'http',
hostname: 'www.gnxsoft.com',
pathname: '/media/**',
},
{
protocol: 'http',
hostname: 'www.gnxsoft.com',
pathname: '/images/**',
},
],
// Legacy domains format for additional compatibility
domains: ['images.unsplash.com'],
domains: ['images.unsplash.com', 'gnxsoft.com', 'www.gnxsoft.com'],
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
@@ -99,7 +146,7 @@ const nextConfig = {
},
{
key: 'Content-Security-Policy',
value: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: http://localhost:8000 http://localhost:8080; font-src 'self' data:; connect-src 'self' http://localhost:8000 https://www.google-analytics.com; frame-src 'self' https://www.google.com; frame-ancestors 'self'; base-uri 'self'; form-action 'self'"
value: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: https: http://localhost:8000 http://localhost:8080; font-src 'self' data: https://fonts.gstatic.com; connect-src 'self' http://localhost:8000 https://www.google-analytics.com; frame-src 'self' https://www.google.com; frame-ancestors 'self'; base-uri 'self'; form-action 'self'"
},
// Performance Headers
{
@@ -153,7 +200,6 @@ const nextConfig = {
// Rewrites for API proxy (Production: routes /api to backend through nginx)
async rewrites() {
// In development, proxy to Django backend
// In production, nginx handles this
if (process.env.NODE_ENV === 'development') {
return [
{
@@ -166,8 +212,14 @@ const nextConfig = {
},
]
}
// In production, these are handled by nginx reverse proxy
return []
// In production, add rewrite for media files so Next.js image optimization can access them
// This allows Next.js to fetch media images from the internal backend during optimization
return [
{
source: '/media/:path*',
destination: `${process.env.INTERNAL_API_URL || 'http://127.0.0.1:1086'}/media/:path*`,
},
]
},
}