chore(web): support separate public API target for dev proxy (#37363)

This commit is contained in:
KVOJJJin 2026-06-12 14:19:23 +08:00 committed by GitHub
parent c69abf16ae
commit c5ab38b2ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,8 @@ NEXT_PUBLIC_SOCKET_URL=ws://localhost:5001
# Dev proxy routes are configured in web/dev-proxy.config.ts.
# pnpm -C web run dev:proxy loads web/.env.local before evaluating that config file.
DEV_PROXY_TARGET=https://cloud.dify.ai
# Defaults to DEV_PROXY_TARGET when omitted. Set this when Web App public APIs use a different origin.
DEV_PROXY_PUBLIC_TARGET=https://udify.app
DEV_PROXY_HOST=127.0.0.1
DEV_PROXY_PORT=5001

View File

@ -3,6 +3,7 @@ import type { CookieRewriteOptions, DevProxyConfig } from '@langgenius/dev-proxy
const DIFY_CLOUD_TARGET = 'https://cloud.dify.ai'
const DEV_PROXY_TARGET = process.env.DEV_PROXY_TARGET || DIFY_CLOUD_TARGET
const DEV_PROXY_ENTERPRISE_TARGET = process.env.DEV_PROXY_ENTERPRISE_TARGET || DEV_PROXY_TARGET
const DEV_PROXY_PUBLIC_TARGET = process.env.DEV_PROXY_PUBLIC_TARGET || DEV_PROXY_TARGET
const DEV_PROXY_HOST = process.env.DEV_PROXY_HOST || '127.0.0.1'
const DEV_PROXY_PORT = Number(process.env.DEV_PROXY_PORT || 5001)
@ -46,10 +47,16 @@ export default {
{
paths: [
'/console/api',
'/api',
],
target: DEV_PROXY_TARGET,
cookieRewrite: difyCookieRewrite,
},
{
paths: [
'/api',
],
target: DEV_PROXY_PUBLIC_TARGET,
cookieRewrite: difyCookieRewrite,
},
],
} satisfies DevProxyConfig