Fix: Append :path* to FASTAPI_URL in rewrites
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 35s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m11s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s

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 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-02-03 11:00:18 +00:00
parent a3966e0c31
commit 53e11aca82

View File

@@ -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*`,
},
];
},