mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-22 04:07:36 +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) {
|
||||
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 || "";
|
||||
return new URL(
|
||||
`${basePath}${path}`,
|
||||
forwardedHost?.startsWith("https://")
|
||||
forwardedHost?.startsWith("http")
|
||||
? forwardedHost
|
||||
: `https://${forwardedHost}`,
|
||||
);
|
||||
|
@@ -81,12 +81,14 @@ export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): {
|
||||
} else if (process.env.ZITADEL_API_URL) {
|
||||
instanceUrl = process.env.ZITADEL_API_URL;
|
||||
} 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) {
|
||||
const [hostname, port] = host.split(":");
|
||||
if (hostname !== "localhost") {
|
||||
instanceUrl = host.startsWith("https://") ? host : `https://${host}`;
|
||||
instanceUrl = host.startsWith("http") ? host : `https://${host}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user