Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy through with x-zitadel-forwarded #43

Closed
wants to merge 19 commits into from
9 changes: 7 additions & 2 deletions apps/login/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ const INSTANCE = process.env.ZITADEL_API_URL;
const SERVICE_USER_ID = process.env.ZITADEL_SERVICE_USER_ID as string;

export function middleware(request: NextRequest) {
const requestHeaders = new Headers(request.headers);
const requestHeaders = new Headers();
requestHeaders.set("x-zitadel-login-client", SERVICE_USER_ID);

requestHeaders.set("Forwarded", `host="${request.nextUrl.host}"`);
requestHeaders.set(
"x-zitadel-forwarded",
`host="${INSTANCE?.replace("https://", "")}"`
);

// requestHeaders.delete("forwarded");

const responseHeaders = new Headers();
responseHeaders.set("Access-Control-Allow-Origin", "*");
Expand Down
Loading