mirror of
https://github.com/langgenius/dify.git
synced 2026-06-12 19:53:38 +08:00
chore(web): support separate public API target for dev proxy (#37363)
This commit is contained in:
parent
c69abf16ae
commit
c5ab38b2ad
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user