From 03cd2e39ab3cf42b7ea50cbc5d0fed944032531d Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Fri, 12 Jun 2026 11:04:23 +0100 Subject: [PATCH] =?UTF-8?q?fix(middleware):=20fetch=20redirects=20via=2012?= =?UTF-8?q?7.0.0.1=20=E2=80=94=20localhost=20resolves=20to=20::1=20in=20Do?= =?UTF-8?q?cker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- src/middleware.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 4528d31..9856100 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -28,7 +28,9 @@ async function getRedirects(siteURL: string) { } export async function middleware(request: NextRequest) { - const siteURL = process.env['NEXT_PUBLIC_SITE_URL'] ?? 'http://localhost:3000' + // Internal self-fetch: must be 127.0.0.1, not localhost — in Docker localhost + // resolves to ::1 while Next listens on IPv4 only, so the fetch fails silently. + const siteURL = process.env['INTERNAL_API_URL'] ?? 'http://127.0.0.1:3000' const pathname = request.nextUrl.pathname const redirects = await getRedirects(siteURL)