AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): forward X-API-Key header through proxy (#11530)
Swifty6588110bf2b2
diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.tsindex 8607b45da0..7e20783042 100644--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts@@ -1,4 +1,7 @@-import { IMPERSONATION_HEADER_NAME } from "@/lib/constants";+import {+ API_KEY_HEADER_NAME,+ IMPERSONATION_HEADER_NAME,+} from "@/lib/constants";import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";import { environment } from "@/services/environment";import { Key, storage } from "@/services/storage/local-storage";@@ -154,6 +157,12 @@ export function createRequestHeaders(if (impersonationHeader) {headers[IMPERSONATION_HEADER_NAME] = impersonationHeader;}++ // Forward X-API-Key header if present+ const apiKeyHeader = originalRequest.headers.get(API_KEY_HEADER_NAME);+ if (apiKeyHeader) {+ headers[API_KEY_HEADER_NAME] = apiKeyHeader;+ }}return headers;diff --git a/autogpt_platform/frontend/src/lib/constants.ts b/autogpt_platform/frontend/src/lib/constants.tsindex f275dbf919..433a37b00e 100644--- a/autogpt_platform/frontend/src/lib/constants.ts+++ b/autogpt_platform/frontend/src/lib/constants.ts@@ -5,3 +5,6 @@// Admin impersonationexport const IMPERSONATION_HEADER_NAME = "X-Act-As-User-Id";export const IMPERSONATION_STORAGE_KEY = "admin-impersonate-user-id";++// API key authentication+export const API_KEY_HEADER_NAME = "X-API-Key";