fix: use public origins for SSO redirects

This commit is contained in:
2026-07-20 15:04:20 +05:30
parent a75779fa4d
commit 944f83d3f4
57 changed files with 138 additions and 89 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
*/
import type { Context } from "@wrnexus/core";
import { currentAppOrigin } from "./workspace.ts";
export type RequestContext = Pick<Context, "req" | "url">;
@@ -127,7 +128,7 @@ export function redirectToLogin(
loginUrl: string | URL,
options: LoginRedirectOptions = {},
): Response {
const target = new URL(loginUrl, ctx.url.origin);
const target = new URL(loginUrl, `${currentAppOrigin() ?? ctx.url.origin}/`);
if (target.protocol !== "http:" && target.protocol !== "https:") {
throw new TypeError("Login URL must use http or https");
}