mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
feat(ui): support NEXT_PUBLIC_LITELLM_PROXY_URL to override backend URL in dev
The hardcoded localhost:4000 default in networking.tsx made it impossible to run the frontend dev server against a port-forwarded K8s backend without manually setting localStorage. Add NEXT_PUBLIC_LITELLM_PROXY_URL as the top-level override in defaultProxyBaseUrl. When set, all API calls (including the getUiConfig discovery request) go to that URL. Falls back to the existing localhost:4000 / NEXT_PUBLIC_USE_REWRITES logic unchanged. Also fix getUiConfig to use proxyBaseUrl instead of defaultProxyBaseUrl, so that litellm_worker_url set via localStorage is also respected for the initial discovery request. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
525e3e38d0
commit
04adf03077
1 changed files with 5 additions and 2 deletions
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue