From c99a772b541488ce203af3eadbefa0103aa3a005 Mon Sep 17 00:00:00 2001 From: KV-Tube Deployer Date: Thu, 26 Mar 2026 14:16:55 +0700 Subject: [PATCH] fix: use relative API URLs with Next.js proxy --- frontend/app/clientActions.ts | 4 ++-- frontend/next.config.mjs | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/frontend/app/clientActions.ts b/frontend/app/clientActions.ts index 13d4a4a..e5a879a 100644 --- a/frontend/app/clientActions.ts +++ b/frontend/app/clientActions.ts @@ -2,8 +2,8 @@ import { VideoData } from './constants'; -// Backend API base URL -const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080/api'; +// Use relative URLs - Next.js rewrites will proxy to backend +const API_BASE = '/api'; // Transform backend response to our VideoData format function transformVideo(item: any): VideoData { diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index e34dc53..072bfc1 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -14,16 +14,13 @@ const nextConfig = { ], }, async rewrites() { - const apiBase = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8080'; + // Backend runs on port 8080 inside the container + const apiBase = 'http://localhost:8080'; return [ { source: '/api/:path*', destination: `${apiBase}/api/:path*`, }, - { - source: '/video_proxy', - destination: `${apiBase}/video_proxy`, - }, ]; }, };