Fix: use INTERNAL_API_URL for runtime backend URL (NEXT_PUBLIC_ is baked at build time)
This commit is contained in:
1 parent
60cd973dc8
commit
2115f406b8
1 file changed
+3
-2
@@ -27,8 +27,9 @@ async function handleProxy(req: NextRequest, { params }: { params: Promise<{ rou
|
|||||||
|
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
|
|
||||||
// Force ALL traffic to go through our own Centralized Proxy Server (Express Backend)
|
// INTERNAL_API_URL is read at RUNTIME (not baked at build time like NEXT_PUBLIC_*)
|
||||||
const localBase = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:3001';
|
// This allows Docker Swarm / Portainer to set the backend URL dynamically
|
||||||
|
const localBase = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:3001';
|
||||||
const destinationUrl = `${localBase}/api/${route}${url.search}`;
|
const destinationUrl = `${localBase}/api/${route}${url.search}`;
|
||||||
|
|
||||||
// Prepare headers
|
// Prepare headers
|
||||||
|
|||||||
Reference in new issue
Block a user