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:
@@ -10,7 +10,7 @@ export async function POST(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const searchQuery = region ? `${query} ${region}` : query;
|
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) ──────────────────────────────────────────
|
// ── 1. Maps job (always, max 60) ──────────────────────────────────────────
|
||||||
const mapsRes = await fetch(`${base}/api/jobs/maps-enrich`, {
|
const mapsRes = await fetch(`${base}/api/jobs/maps-enrich`, {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export async function POST(req: NextRequest) {
|
|||||||
};
|
};
|
||||||
const { query, region, targetCount, foundCount } = body;
|
const { query, region, targetCount, foundCount } = body;
|
||||||
|
|
||||||
const base = req.nextUrl.origin;
|
const base = `http://localhost:${process.env.PORT || 3000}`;
|
||||||
const deficit = targetCount - foundCount;
|
const deficit = targetCount - foundCount;
|
||||||
|
|
||||||
// 1. Try to generate an optimized query via GPT-4.1
|
// 1. Try to generate an optimized query via GPT-4.1
|
||||||
|
|||||||
Reference in New Issue
Block a user