You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(proxy): allow local and private endpoints when testing AI connection (#602) - #605
When adding a local AI endpoint (e.g. Ollama on http://127.0.0.1:11434/v1 or a LAN model on http://192.168.x.x), clicking "Test connection" in the unsaved configuration form previously failed with a 502 Bad Gateway error (Blocked proxy request: hostname '127.0.0.1' is not allowed). However, once saved, the config worked normally because allowPrivate was conditionally set to Boolean(configId).
This PR sets allowPrivate = true for /api/proxy/ai, allowing users to test local and private network endpoints before saving, matching the behavior of the WebDAV proxy test endpoint.
Changes
Enable allowPrivate: true in /api/proxy/ai:
Both saved configurations (configId) and unsaved inline configurations (config) can now target localhost / 127.0.0.1 and private LAN endpoints over HTTP/HTTPS.
…ion (#602)
- Enable allowPrivate for /api/proxy/ai requests across both saved configs and unsaved inline configs
- Allows testing local endpoints (e.g. Ollama on 127.0.0.1:11434) and LAN endpoints before saving
- Preserves IMDS (169.254.169.254) cloud metadata blocking
- Adds unit tests verifying inline local and private proxy requests
Testing an unsaved AI connection against localhost or LAN endpoints now behaves the same as for a saved one. Cloud metadata addresses stay blocked. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
标题与变更内容一致。变更将 /api/proxy/ai 的 allowPrivate 设为 true,使已保存和未保存的内联 AI 配置都能访问本地或私有网络端点。标题描述了主要修复点(测试 AI 连接时允许本地和私有端点),且与 PR 目标和关联议题 #602 相符。标题中的 (#602) 是议题编号,不影响判断。
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 67af48c3-a351-44e2-b372-2ac50123b572
Commits
Reviewing files that changed from the base of the PR and between 6b895ac and cd0e348.
Files selected for processing: 3
server/src/routes/proxy.ts
server/src/services/proxyService.ts
server/tests/routes/aiProxyRoute.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
review: highghfind author score; see https://ghfind.com
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #602.
When adding a local AI endpoint (e.g. Ollama on
http://127.0.0.1:11434/v1or a LAN model onhttp://192.168.x.x), clicking "Test connection" in the unsaved configuration form previously failed with a502 Bad Gatewayerror (Blocked proxy request: hostname '127.0.0.1' is not allowed). However, once saved, the config worked normally becauseallowPrivatewas conditionally set toBoolean(configId).This PR sets
allowPrivate = truefor/api/proxy/ai, allowing users to test local and private network endpoints before saving, matching the behavior of the WebDAV proxy test endpoint.Changes
Enable
allowPrivate: truein/api/proxy/ai:configId) and unsaved inline configurations (config) can now target localhost / 127.0.0.1 and private LAN endpoints over HTTP/HTTPS.169.254.169.254,fd00:ec2::254,0.0.0.0,::) remains strictly enforced byALWAYS_BLOCKED_RESOLVED_IPS.Align docstrings in
proxyService.ts:ValidateUrlOptionscomment to reflect that both saved and test connection AI configs use lenient private endpoint access.Unit Tests & Verification:
server/tests/routes/aiProxyRoute.test.tsto test inline local/LAN proxy requests, saved configs, and validation errors.http://127.0.0.1:11434/v1with HTTP 200 return.Summary by CodeRabbit