fix(middleware): fetch redirects via 127.0.0.1 — localhost resolves to ::1 in Docker
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
109b3d058e
commit
03cd2e39ab
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue