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>
This commit is contained in:
AutonetSellCar Deploy
2026-01-03 18:32:00 +09:00
parent 7c943d8553
commit 77e707167f
19 changed files with 48 additions and 21 deletions

View File

@@ -108,7 +108,7 @@ const FUEL_TYPES = [
{ value: 'LPG', label: 'LPG' },
];
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
// 이미지 URL 변환 (로컬 경로는 백엔드 URL 추가)
const getImageUrl = (url: string | undefined): string => {

View File

@@ -5,7 +5,7 @@ import { useRouter } from 'next/navigation';
import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface DealerApplication {
id: number;

View File

@@ -33,7 +33,7 @@ const defaultFormData: BannerFormData = {
car_id: null,
};
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
// 이미지 URL 변환 (로컬 경로는 백엔드 URL 추가)
const getImageUrl = (url: string | undefined): string => {

View File

@@ -42,7 +42,7 @@ interface ExchangeRateWeights {
cny: number;
}
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
export default function SettingsPage() {
const [settings, setSettings] = useState<SystemSettings | null>(null);

View File

@@ -9,7 +9,7 @@ import { useTranslation } from '@/lib/i18n';
import { useTranslate } from '@/lib/useTranslate';
// 이미지 URL 변환 (로컬 경로는 백엔드 URL 추가)
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
const getImageUrl = (url: string | undefined): string => {
if (!url) return '';

View File

@@ -6,7 +6,7 @@ import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
import SidebarLayout from '@/components/SidebarLayout';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface CCPackage {
id: number;

View File

@@ -6,7 +6,7 @@ import Link from 'next/link';
import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface CheckoutResult {
status: string;

View File

@@ -19,7 +19,7 @@ const CUSTOMS_FEE_USD = 200; // $200
const SMALL_CAR_RATIO = 2.75; // 27.5% of total
const COMPACT_CAR_RATIO = 2.25; // 22.5% of total
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
// Container matching simulation
interface ContainerSlot {

View File

@@ -6,7 +6,7 @@ import Link from 'next/link';
import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface DealerApplication {
id: number;

View File

@@ -6,7 +6,7 @@ import Link from 'next/link';
import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface DealerInfo {
id: number;

View File

@@ -3,7 +3,7 @@
import { useState, useEffect } from 'react';
import { useTranslation } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface ExchangeRateData {
currency_code: string;

View File

@@ -6,7 +6,7 @@ import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
import SidebarLayout from '@/components/SidebarLayout';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface VehicleShare {
id: number;

View File

@@ -6,7 +6,7 @@ import { useAuthStore } from '@/lib/store';
import { useTranslation } from '@/lib/i18n';
import { authApi } from '@/lib/api';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
export default function ProfilePage() {
const { t, language } = useTranslation();

View File

@@ -6,7 +6,7 @@ import Link from 'next/link';
import { useAuthStore } from '@/lib/store';
import { useTranslation, translateCarName } from '@/lib/i18n';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '';
interface SharedVehicleData {
share: {