diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 16f35605877..b235c75ed2e 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -80,10 +80,13 @@ import NotificationsManager from "./molecules/notifications_manager"; const isLocal = process.env.NODE_ENV === "development"; // In dev, if NEXT_PUBLIC_USE_REWRITES=true the Next.js dev server proxies API calls // to the backend — use relative URLs (null) so rewrites can intercept them. +// NEXT_PUBLIC_LITELLM_PROXY_URL overrides the hardcoded localhost:4000 default, +// which is useful when running the frontend against a port-forwarded K8s backend. const defaultProxyBaseUrl = - isLocal && process.env.NEXT_PUBLIC_USE_REWRITES !== "true" + process.env.NEXT_PUBLIC_LITELLM_PROXY_URL ?? + (isLocal && process.env.NEXT_PUBLIC_USE_REWRITES !== "true" ? "http://localhost:4000" - : null; + : null); const defaultServerRootPath = "/"; export let serverRootPath = defaultServerRootPath; const WORKER_URL_KEY = "litellm_worker_url";