Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: configure server console api url (#36958)
yyh1b37635f925d
diff --git a/docker/.env.example b/docker/.env.exampleindex c723d25d9b0..33809eac2fa 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -13,6 +13,7 @@# Core service URLsCONSOLE_API_URL=+SERVER_CONSOLE_API_URL=http://api:5001CONSOLE_WEB_URL=SERVICE_API_URL=TRIGGER_URL=http://localhostdiff --git a/docker/README.md b/docker/README.mdindex 2e21a2ce8f9..3f3251a0784 100644--- a/docker/README.md+++ b/docker/README.md@@ -80,7 +80,8 @@ The root `.env.example` file contains the essential startup settings. Optional a1. **Common Variables**:- - `CONSOLE_API_URL`, `CONSOLE_WEB_URL`, `SERVICE_API_URL`, `APP_API_URL`, `APP_WEB_URL`: URLs for the API and frontend services.+ - `CONSOLE_API_URL`, `CONSOLE_WEB_URL`, `SERVICE_API_URL`, `APP_API_URL`, `APP_WEB_URL`: public URLs for the API and frontend services.+ - `SERVER_CONSOLE_API_URL`: internal URL used by the web service for server-side console API requests. Keep the default `http://api:5001` for standard Docker Compose deployments, and only change it when your web service must reach the API through a different internal address.- `FILES_URL`, `INTERNAL_FILES_URL`: Public and internal base URLs for file downloads and previews.- `ENDPOINT_URL_TEMPLATE`, `NEXT_PUBLIC_SOCKET_URL`, `TRIGGER_URL`: Additional service URLs.diff --git a/docker/docker-compose-template.yaml b/docker/docker-compose-template.yamlindex d3cff12a4b3..309ea20eb6f 100644--- a/docker/docker-compose-template.yaml+++ b/docker/docker-compose-template.yaml@@ -376,6 +376,7 @@ services:- ./.envenvironment:CONSOLE_API_URL: ${CONSOLE_API_URL:-}+ SERVER_CONSOLE_API_URL: ${SERVER_CONSOLE_API_URL:-http://api:5001}APP_API_URL: ${APP_API_URL:-}AMPLITUDE_API_KEY: ${AMPLITUDE_API_KEY:-}NEXT_PUBLIC_COOKIE_DOMAIN: ${NEXT_PUBLIC_COOKIE_DOMAIN:-}diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex da94f7f16c8..d8aee5bb1e9 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -382,6 +382,7 @@ services:- ./.envenvironment:CONSOLE_API_URL: ${CONSOLE_API_URL:-}+ SERVER_CONSOLE_API_URL: ${SERVER_CONSOLE_API_URL:-http://api:5001}APP_API_URL: ${APP_API_URL:-}AMPLITUDE_API_KEY: ${AMPLITUDE_API_KEY:-}NEXT_PUBLIC_COOKIE_DOMAIN: ${NEXT_PUBLIC_COOKIE_DOMAIN:-}diff --git a/web/config/__tests__/server.spec.ts b/web/config/__tests__/server.spec.tsnew file mode 100644index 00000000000..2217832e93f--- /dev/null+++ b/web/config/__tests__/server.spec.ts@@ -0,0 +1,43 @@+// @vitest-environment node++import { afterEach, describe, expect, it, vi } from 'vitest'++vi.mock('server-only', () => ({}))++const importServerConfig = async () => {+ vi.resetModules()+ return import('../server')+}++describe('server config', () => {+ afterEach(() => {+ vi.unstubAllEnvs()+ })++ it('should prefer the server-only console API URL for server requests', async () => {+ vi.stubEnv('SERVER_CONSOLE_API_URL', 'http://api:5001')+ vi.stubEnv('CONSOLE_API_URL', 'https://console.example.com')++ const { SERVER_CONSOLE_API_PREFIX } = await importServerConfig()++ expect(SERVER_CONSOLE_API_PREFIX).toBe('http://api:5001/console/api')+ })++ it('should fall back to the public console API URL when no server-only URL is configured', async () => {+ vi.stubEnv('SERVER_CONSOLE_API_URL', '')+ vi.stubEnv('CONSOLE_API_URL', 'https://console.example.com')++ const { SERVER_CONSOLE_API_PREFIX } = await importServerConfig()++ expect(SERVER_CONSOLE_API_PREFIX).toBe('https://console.example.com/console/api')+ })++ it('should remain unconfigured when both server URLs are empty', async () => {+ vi.stubEnv('SERVER_CONSOLE_API_URL', '')+ vi.stubEnv('CONSOLE_API_URL', '')++ const { SERVER_CONSOLE_API_PREFIX } = await importServerConfig()++ expect(SERVER_CONSOLE_API_PREFIX).toBeUndefined()+ })+})diff --git a/web/config/server.ts b/web/config/server.tsindex 388363642d2..f1ecb4654bd 100644--- a/web/config/server.ts+++ b/web/config/server.ts@@ -5,6 +5,8 @@ import 'server-only'const withoutTrailingSlash = (value: string) => value.endsWith('/') ? value.slice(0, -1) : value// Server-side requests need the origin; browser requests should keep using NEXT_PUBLIC_API_PREFIX.-export const SERVER_CONSOLE_API_PREFIX = env.CONSOLE_API_URL- ? `${withoutTrailingSlash(env.CONSOLE_API_URL)}/console/api`+const serverConsoleApiUrl = env.SERVER_CONSOLE_API_URL || env.CONSOLE_API_URL++export const SERVER_CONSOLE_API_PREFIX = serverConsoleApiUrl+ ? `${withoutTrailingSlash(serverConsoleApiUrl)}/console/api`: undefineddiff --git a/web/env.ts b/web/env.tsindex bccee4fa53b..22b33b10895 100644--- a/web/env.ts+++ b/web/env.ts@@ -161,6 +161,7 @@ const clientSchema = {export const env = createEnv({server: {CONSOLE_API_URL: z.string().optional(),+ SERVER_CONSOLE_API_URL: z.string().optional(),/*** Maximum length of segmentation tokens for indexing*/