-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
概要
External Apps のプロキシルートハンドラが pathPrefix を除去してupstreamに転送しているため、basePath を設定したアプリケーションに接続できず Bad Gateway エラーが発生する。
現象
http://localhost:3000/proxy/localllmtest/にアクセスすると{"error":"Bad Gateway","message":"Unable to connect to upstream server"}が返るhttp://localhost:3012/proxy/localllmtest/に直接アクセスすると正常に表示される
原因
src/lib/proxy/handler.ts の buildUpstreamUrl() が pathPrefix を除去してupstreamに転送している。
// 現在の実装(handler.ts:39-43)
export function buildUpstreamUrl(app: ExternalApp, path: string): string {
return `http://${app.targetHost}:${app.targetPort}${path}`;
}プロキシルートハンドラ(src/app/proxy/[...path]/route.ts:30-31)が pathPrefix を除去:
const [pathPrefix, ...rest] = pathSegments;
const path = '/' + rest.join('/'); // pathPrefix が含まれないこれにより:
ブラウザ: GET /proxy/localllmtest/page
↓ pathPrefix除去
upstream: GET http://localhost:3012/page ← 404(basePath設定済みアプリでは存在しないパス)
期待動作
設計書(Issue #42)ではアプリ側に basePath: '/proxy/{pathPrefix}' の設定を要求しているため、プロキシは pathPrefix を保持してupstreamに転送すべき。
ブラウザ: GET /proxy/localllmtest/page
↓ pathPrefix保持
upstream: GET http://localhost:3012/proxy/localllmtest/page ← 200
修正対象
src/lib/proxy/handler.ts
buildUpstreamUrl()で/proxy/{pathPrefix}を含むパスをupstreamに転送するよう修正
src/app/proxy/[...path]/route.ts
handleProxy()で pathPrefix を含むパスをproxyHttp()/proxyWebSocket()に渡すよう修正
影響範囲
- External Apps 機能を利用している全アプリに影響
- basePath 未設定のアプリ(ルート
/で動作するアプリ)は動作が変わるため注意が必要
受入条件
-
http://localhost:3000/proxy/{pathPrefix}/経由でbasePath設定済みアプリにアクセスできる - ヘルスチェックが正常に動作する
- 既存のテストが通る
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels