mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-20 03:47:41 +00:00
proto
This commit is contained in:
@@ -111,14 +111,19 @@ export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function constructUrl(request: NextRequest, path: string) {
|
export function constructUrl(request: NextRequest, path: string) {
|
||||||
|
const forwardedProto =
|
||||||
|
request.headers.get("x-forwarded-proto") ?? request.nextUrl.protocol;
|
||||||
|
|
||||||
const forwardedHost =
|
const forwardedHost =
|
||||||
request.headers.get("x-zitadel-forward-host") ??
|
request.headers.get("x-zitadel-forward-host") ??
|
||||||
request.headers.get("host");
|
request.headers.get("host");
|
||||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
||||||
return new URL(
|
return new URL(
|
||||||
`${basePath}${path}`,
|
`${basePath}${path}`,
|
||||||
|
|
||||||
|
// keep this check to allow localhost for local development
|
||||||
forwardedHost?.startsWith("http")
|
forwardedHost?.startsWith("http")
|
||||||
? forwardedHost
|
? forwardedHost
|
||||||
: `https://${forwardedHost}`,
|
: `${forwardedProto}//${forwardedHost}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user