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
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:
@@ -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}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user