From 53e11aca82427d6d011804ccc2f0af244f5f6404 Mon Sep 17 00:00:00 2001 From: Tudor Date: Tue, 3 Feb 2026 11:00:18 +0000 Subject: [PATCH] Fix: Append :path* to FASTAPI_URL in rewrites The rewrite destination was using FASTAPI_URL directly, which replaced the entire destination including the :path* parameter. This caused /api/compare to rewrite to just http://backend:80/api instead of http://backend:80/api/compare. Now properly constructs: ${FASTAPI_URL}/:path* Co-Authored-By: Claude Opus 4.5 --- nextjs-app/next.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nextjs-app/next.config.js b/nextjs-app/next.config.js index 094f506..68fc955 100644 --- a/nextjs-app/next.config.js +++ b/nextjs-app/next.config.js @@ -5,10 +5,11 @@ const nextConfig = { // API Proxy to FastAPI backend async rewrites() { + const apiUrl = process.env.FASTAPI_URL || 'http://localhost:8000/api'; return [ { source: '/api/:path*', - destination: process.env.FASTAPI_URL || 'http://localhost:8000/api/:path*', + destination: `${apiUrl}/:path*`, }, ]; },