Use HTML meta-refresh for external OAuth redirects behind IIS ARR
ARR's machine-level reverseRewriteHostInResponseHeaders rewrote the host of Location headers, sending Facebook/Google login dialogs to loma.chat/v21.0/... Serve a 200 HTML hop to the provider URL instead of a 3xx Location. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { NextResponse } from "next/server";
|
||||
import { getCurrentUser, isSuperadmin } from "@/lib/auth/user";
|
||||
import { authorizeUrl, createOAuthState, OAUTH_STATE_COOKIE } from "@/lib/facebook/oauth";
|
||||
import { safeFacebookErrorMessage } from "@/lib/facebook/client";
|
||||
import { externalRedirect } from "@/lib/http";
|
||||
|
||||
/** SUPERADMIN only: redirects to the Facebook consent dialog. */
|
||||
export async function GET(req: Request) {
|
||||
@@ -13,7 +14,7 @@ export async function GET(req: Request) {
|
||||
|
||||
try {
|
||||
const { nonce, cookie } = await createOAuthState(user.id);
|
||||
const res = NextResponse.redirect(authorizeUrl(origin, nonce));
|
||||
const res = externalRedirect(authorizeUrl(origin, nonce));
|
||||
res.cookies.set(OAUTH_STATE_COOKIE, cookie, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
|
||||
Reference in New Issue
Block a user