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

This commit is contained in:
Ivan Rezchikov
2026-09-18 01:50:22 +03:00
parent 7d46042102
commit c84b18faa8
3 changed files with 9 additions and 8 deletions
+4 -2
View File
@@ -11,9 +11,11 @@ export async function GET(req: Request) {
const storedState = cookieStore.get("oauth_state")?.value;
const verifier = cookieStore.get("oauth_verifier")?.value;
const origin = new URL(process.env.FRONTEND_URL ?? "http://localhost:3000").origin;
const fail = (reason: string) => {
const response = NextResponse.redirect(
new URL(`/oauth/error?reason=${reason}`, url.origin)
new URL(`/oauth/error?reason=${reason}`, origin)
);
response.cookies.delete("oauth_verifier");
response.cookies.delete("oauth_state");
@@ -47,7 +49,7 @@ export async function GET(req: Request) {
const { session_token } = await sessionResponse.json();
const response = NextResponse.redirect(new URL("/collections", url.origin));
const response = NextResponse.redirect(new URL("/collections", origin));
response.cookies.set("session", session_token, {
httpOnly: true,