Files
AutonetSellCar/frontend/next.config.js
AutonetSellCar Deploy 77e707167f Fix Mixed Content issue on staging (HTTPS/HTTP mismatch)
- Add Next.js API rewrites to proxy /api and /uploads requests
- Update docker-compose.staging.yml to use relative API paths
- Set NEXT_PUBLIC_API_URL to empty for staging (use rewrites)
- Add BACKEND_URL env var for Next.js server-side proxying
- Update all files to use relative paths when API_URL is empty

This fixes the issue where the staging site (HTTPS) was trying to
load resources from HTTP backend, causing Mixed Content errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:32:00 +09:00

63 lines
1.4 KiB
JavaScript

/** @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