fix: eliminate ZITADEL_SERVICE_USER_ID

This commit is contained in:
Max Peintner
2025-02-24 16:54:09 +01:00
parent 58ff71d885
commit a2edb62005
6 changed files with 11 additions and 29 deletions

View File

@@ -1,5 +1,4 @@
ZITADEL_API_URL=http://localhost:22222
ZITADEL_SERVICE_USER_ID="yolo"
ZITADEL_SERVICE_USER_TOKEN="yolo"
EMAIL_VERIFICATION=true
DEBUG=true

View File

@@ -22,10 +22,6 @@ declare namespace NodeJS {
*/
ZITADEL_INSTANCE_HOST_HEADER: string;
/**
* Self hosting: The service user id
*/
ZITADEL_SERVICE_USER_ID: string;
/**
* Self hosting: The service user token
*/

View File

@@ -13,11 +13,7 @@ export const config = {
export async function middleware(request: NextRequest) {
// escape proxy if the environment is setup for multitenancy
if (
!process.env.ZITADEL_API_URL ||
!process.env.ZITADEL_SERVICE_USER_ID ||
!process.env.ZITADEL_SERVICE_USER_TOKEN
) {
if (!process.env.ZITADEL_API_URL || !process.env.ZITADEL_SERVICE_USER_TOKEN) {
return NextResponse.next();
}
@@ -28,10 +24,6 @@ export async function middleware(request: NextRequest) {
const instanceHost = `${serviceUrl}`.replace("https://", "");
const requestHeaders = new Headers(request.headers);
requestHeaders.set(
"x-zitadel-login-client",
process.env.ZITADEL_SERVICE_USER_ID,
);
// this is a workaround for the next.js server not forwarding the host header
// requestHeaders.set("x-zitadel-forwarded", `host="${request.nextUrl.host}"`);