Fix internal API calls in Docker (use localhost instead of origin)

req.nextUrl.origin resolves to external domain behind a reverse proxy,
breaking server-to-server fetch calls. Use localhost:PORT instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Timo Uttenweiler
2026-04-09 11:22:57 +02:00
parent 807b82f633
commit b01d14b784
2 changed files with 2 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ export async function POST(req: NextRequest) {
}
const searchQuery = region ? `${query} ${region}` : query;
const base = req.nextUrl.origin;
const base = `http://localhost:${process.env.PORT || 3000}`;
// ── 1. Maps job (always, max 60) ──────────────────────────────────────────
const mapsRes = await fetch(`${base}/api/jobs/maps-enrich`, {

View File

@@ -12,7 +12,7 @@ export async function POST(req: NextRequest) {
};
const { query, region, targetCount, foundCount } = body;
const base = req.nextUrl.origin;
const base = `http://localhost:${process.env.PORT || 3000}`;
const deficit = targetCount - foundCount;
// 1. Try to generate an optimized query via GPT-4.1