/** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', images: { remotePatterns: [ { protocol: 'http', hostname: 'dealer.carmodoo.com', pathname: '/data/**', }, { protocol: 'https', hostname: 'dealer.carmodoo.com', pathname: '/data/**', }, { protocol: 'https', hostname: 'images.unsplash.com', pathname: '/**', }, { protocol: 'http', hostname: 'localhost', pathname: '/uploads/**', }, { protocol: 'http', hostname: '192.168.0.202', pathname: '/uploads/**', }, { protocol: 'https', hostname: 'staging.autonetsellcar.com', pathname: '/uploads/**', }, { protocol: 'https', hostname: 'autonetsellcar.com', pathname: '/uploads/**', }, ], }, env: { // Don't override empty string - it means use relative paths with rewrites NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, }, async rewrites() { const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; return [ { source: '/api/:path*', destination: `${backendUrl}/api/:path*`, }, { source: '/uploads/:path*', destination: `${backendUrl}/uploads/:path*`, }, ]; }, } module.exports = nextConfig