mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 02:02:23 +00:00
api to 8080 of localhost
This commit is contained in:
@@ -201,11 +201,13 @@ async function findValidSession(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function constructUrl(request: NextRequest, path: string) {
|
function constructUrl(request: NextRequest, path: string) {
|
||||||
const forwardedHost = request.headers.get("host");
|
// TODO: remove localhost
|
||||||
|
const forwardedHost =
|
||||||
|
request.headers.get("x-zitadel-forward-host") ?? "http://localhost:8080";
|
||||||
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}`,
|
||||||
forwardedHost?.startsWith("https://")
|
forwardedHost?.startsWith("http")
|
||||||
? forwardedHost
|
? forwardedHost
|
||||||
: `https://${forwardedHost}`,
|
: `https://${forwardedHost}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -81,12 +81,14 @@ export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): {
|
|||||||
} else if (process.env.ZITADEL_API_URL) {
|
} else if (process.env.ZITADEL_API_URL) {
|
||||||
instanceUrl = process.env.ZITADEL_API_URL;
|
instanceUrl = process.env.ZITADEL_API_URL;
|
||||||
} else {
|
} else {
|
||||||
const host = headers.get("host");
|
// TODO: remove this fallback once the host header is always set
|
||||||
|
const host =
|
||||||
|
headers.get("x-zitadel-forward-host") ?? "http://localhost:8080";
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
const [hostname, port] = host.split(":");
|
const [hostname, port] = host.split(":");
|
||||||
if (hostname !== "localhost") {
|
if (hostname !== "localhost") {
|
||||||
instanceUrl = host.startsWith("https://") ? host : `https://${host}`;
|
instanceUrl = host.startsWith("http") ? host : `https://${host}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user