fix: use PITCH_BASE_URL for short link redirects instead of request.url
Build pitch-deck / build-push-deploy (push) Successful in 1m39s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 32s
CI / test-python-voice (push) Successful in 32s
CI / test-bqas (push) Successful in 29s

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 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-05-07 10:55:53 +02:00
parent d291af0e33
commit 1ef22e6f95
+4 -2
View File
@@ -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}`)
}