Update absolute URL construction in favico API GET route to support environment variable

This commit is contained in:
m4x809 2025-10-25 14:11:55 +02:00
parent 8d99f739c1
commit 688255f8bd
Signed by: m4x809
SSH key fingerprint: SHA256:YCoFF78p2DUP94EnCScqLwldjkKDwdKSZq3r8p/6EiU

View file

@ -31,7 +31,7 @@ export async function GET(request: NextRequest) {
console.log("🚀 ~ route.tsx:29 ~ GET ~ imagePath:", imagePath);
// Build absolute URL for the redirect
const { nextUrl } = request;
const absoluteUrl = `${nextUrl.protocol}//${nextUrl.host}${imagePath}`;
const absoluteUrl = urlENV ? `${urlENV}${imagePath}` : `${nextUrl.protocol}//${nextUrl.host}${imagePath}`;
console.log("🚀 ~ route.tsx:33 ~ GET ~ absoluteUrl:", absoluteUrl);
return NextResponse.redirect(absoluteUrl, 307);