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:
Loma Bot Ops
2026-11-23 16:44:26 +07:00
parent fd282c8ce4
commit dc6ee09a55
3 changed files with 20 additions and 2 deletions
@@ -1,4 +1,5 @@
import { appUrl } from "@/lib/base-path";
import { externalRedirect } from "@/lib/http";
import { NextResponse } from "next/server";
import {
authorizeUrl,
@@ -27,7 +28,7 @@ export async function GET(req: Request, ctx: RouteContext<"/api/auth/oauth/[prov
from: safeRedirectPath(url.searchParams.get("from")),
remember: url.searchParams.get("remember") !== "0",
});
const res = NextResponse.redirect(authorizeUrl(provider, url.origin, nonce));
const res = externalRedirect(authorizeUrl(provider, url.origin, nonce));
res.cookies.set(SOCIAL_STATE_COOKIE, cookie, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",