fix: use FRONTEND_URL for redirects behind proxy
Build and Deploy / test-backend (push) Successful in 55s
Build and Deploy / lint-frontend (push) Successful in 12s
Build and Deploy / build-backend (push) Successful in 3s
Build and Deploy / build-frontend (push) Successful in 29s
Build and Deploy / deploy (push) Successful in 5s
Build and Deploy / test-backend (push) Successful in 55s
Build and Deploy / lint-frontend (push) Successful in 12s
Build and Deploy / build-backend (push) Successful in 3s
Build and Deploy / build-frontend (push) Successful in 29s
Build and Deploy / deploy (push) Successful in 5s
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { cookies, headers as fetchHeaders } from "next/headers";
|
||||
import { cookies } from "next/headers";
|
||||
import { generateCodeVerifier, generateCodeChallenge, generateState } from "@/lib/pkce";
|
||||
|
||||
const FLOW_TTL = 60 * 10;
|
||||
|
||||
const origin = () => new URL(process.env.FRONTEND_URL ?? "http://localhost:3000").origin;
|
||||
|
||||
export async function GET() {
|
||||
if ((await cookies()).get("session")) {
|
||||
const headers = await fetchHeaders();
|
||||
const protocol = headers.get("x-forwarded-proto") ?? "http";
|
||||
const host = headers.get("host");
|
||||
const origin = host ? `${protocol}://${host}` : "http://localhost:3000";
|
||||
return NextResponse.redirect(new URL("/", origin));
|
||||
return NextResponse.redirect(new URL("/", origin()));
|
||||
}
|
||||
|
||||
const verifier = generateCodeVerifier();
|
||||
|
||||
Reference in New Issue
Block a user