From 1ef22e6f956bda8f9d65b26af5d9eae34cceb04b Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 7 May 2026 10:55:53 +0200 Subject: [PATCH] fix: use PITCH_BASE_URL for short link redirects instead of request.url Behind Orca's reverse proxy, request.url resolves to http://127.0.0.1:3000 which causes redirects to go to the internal address instead of the public domain. Use PITCH_BASE_URL (already set in service.toml) as the base. Co-Authored-By: Claude Sonnet 4.6 --- pitch-deck/app/p/[code]/route.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pitch-deck/app/p/[code]/route.ts b/pitch-deck/app/p/[code]/route.ts index 396b533..4f0f981 100644 --- a/pitch-deck/app/p/[code]/route.ts +++ b/pitch-deck/app/p/[code]/route.ts @@ -3,6 +3,8 @@ import pool from '@/lib/db' interface Ctx { params: Promise<{ code: string }> } +const BASE_URL = process.env.PITCH_BASE_URL || 'https://pitch.breakpilot.com' + export async function GET(request: NextRequest, ctx: Ctx) { const { code } = await ctx.params @@ -14,8 +16,8 @@ export async function GET(request: NextRequest, ctx: Ctx) { ) if (rows.length === 0) { - return NextResponse.redirect(new URL('/auth?error=invalid', request.url)) + return NextResponse.redirect(`${BASE_URL}/auth?error=invalid`) } - return NextResponse.redirect(new URL(`/auth/verify?token=${rows[0].token}`, request.url)) + return NextResponse.redirect(`${BASE_URL}/auth/verify?token=${rows[0].token}`) }