Bug Description
What happened
When using openai-compat LLM provider with a custom base URL containing a ip & port (e.g., http://10.43.46.12:3000/v1), the Higress AI provider's openaiCustomUrl field is set to the full URL including the port. Higress Console extracts the host:port from this URL and displays it as "自定义 OpenAI 服务主机域" (Custom OpenAI Service Host Domain) = 10.43.46.12:3000.
This causes Higress to use 10.43.46.12:3000 as the host domain for DNS resolution / upstream routing. Since 10.43.46.12:3000 is not a valid DNS hostname, resolution fails and the LLM endpoint is unreachable.
The port is already provided separately via openaiCustomServicePort (displayed as "选择服务" = openai-compat.dns:3000), so including it in openaiCustomUrl is redundant and breaks the host domain.
Actual Higress provider config after initialization:
| Field |
Value |
| 选择服务 |
openai-compat.dns:3000 |
| 自定义 OpenAI 服务路径 |
/v1 |
| 自定义 OpenAI 服务主机域 |
10.43.46.12:3000 ❌ (port included) |
What I expected
The openaiCustomUrl should not include the port. The port should only come from openaiCustomServicePort. The "自定义 OpenAI 服务主机域" should be 10.43.46.12 (without port), and LLM requests should be forwarded to 10.43.46.12:3000 successfully.
Expected Higress provider config:
| Field |
Value |
| 选择服务 |
openai-compat.dns:3000 |
| 自定义 OpenAI 服务路径 |
/v1 |
| 自定义 OpenAI 服务主机域 |
10.43.46.12 ✅ (no port) |
Steps to Reproduce
-
Initialize the system: docker version. use one click script
-
use local ai provider with port such as xx.xx.xxx.xx:3000/v1
AI Analysis
Root Cause
openaiCustomUrl is set to the full base URL (including port) instead of the URL with the port stripped. The port is duplicated — once in openaiCustomUrl (causing the host domain to include the port) and once in openaiCustomServicePort.
Affected code path 1: Go controller
File: hiclaw-controller/internal/initializer/initializer.go (~line 362)
raw := map[string]interface{}{
"hiclawMode": true,
"openaiCustomUrl": cfg.OpenAIBaseURL, // ← "http://10.43.46.12:3000/v1" (port included)
"openaiCustomServiceName": "openai-compat.dns",
"openaiCustomServicePort": port, // ← 3000 (port already provided here)
}
Affected code path 2: Shell script
File: manager/scripts/init/setup-higress.sh (~line 221)
PROVIDER_BODY='{..."rawConfigs":{"openaiCustomUrl":"'"${OPENAI_BASE_URL}"'","openaiCustomServiceName":"openai-compat.dns","openaiCustomServicePort":'"${OC_PORT}"',"hiclawMode":true}}'
# ↑ full URL with port ↑ port already provided here
How it breaks
- Code sets
openaiCustomUrl = http://10.43.46.12:3000/v1 (full URL with port)
- Higress Console extracts host:port from
openaiCustomUrl → displays "自定义 OpenAI 服务主机域" = 10.43.46.12:3000
- Higress uses
10.43.46.12:3000 as the host domain for DNS resolution / upstream routing
10.43.46.12:3000 is not a valid DNS hostname → resolution fails → LLM endpoint unreachable
Suggested Fix
Strip the port from openaiCustomUrl. The port should only come from openaiCustomServicePort.
initializer.go:
u, _ := url.Parse(cfg.OpenAIBaseURL)
customUrl := fmt.Sprintf("%s://%s%s", proto, host, u.Path) // "http://10.43.46.12/v1" (no port)
raw := map[string]interface{}{
"hiclawMode": true,
"openaiCustomUrl": customUrl, // "http://10.43.46.12/v1"
"openaiCustomServiceName": "openai-compat.dns",
"openaiCustomServicePort": port, // 3000
}
setup-higress.sh:
# Extract path from URL
OC_PATH="/${OC_URL_STRIP#*/}"
[ "${OC_PATH}" = "/" ] && OC_PATH=""
# Build openaiCustomUrl without port
OC_CUSTOM_URL="${OC_PROTO}://${OC_DOMAIN}${OC_PATH}" # "http://10.43.46.12/v1" (no port)
PROVIDER_BODY='{..."rawConfigs":{"openaiCustomUrl":"'"${OC_CUSTOM_URL}"'","openaiCustomServiceName":"openai-compat.dns","openaiCustomServicePort":'"${OC_PORT}"',"hiclawMode":true}}'
Related Secondary Bug
ensureServiceSource() and EnsureAIProvider() in higress.go only use POST (treat 409 Conflict as success without updating the existing resource). This means even after fixing the code, existing incorrectly configured providers cannot be corrected by re-running the initializer — they must be manually deleted first. The shell script setup-higress.sh handles this correctly with GET → PUT if exists / POST if not, but the Go controller does not.
Relevant Logs
Component
Install / Setup
Version / Commit
v1.1.2
Bug Description
What happened
When using
openai-compatLLM provider with a custom base URL containing a ip & port (e.g.,http://10.43.46.12:3000/v1), the Higress AI provider'sopenaiCustomUrlfield is set to the full URL including the port. Higress Console extracts the host:port from this URL and displays it as "自定义 OpenAI 服务主机域" (Custom OpenAI Service Host Domain) =10.43.46.12:3000.This causes Higress to use
10.43.46.12:3000as the host domain for DNS resolution / upstream routing. Since10.43.46.12:3000is not a valid DNS hostname, resolution fails and the LLM endpoint is unreachable.The port is already provided separately via
openaiCustomServicePort(displayed as "选择服务" =openai-compat.dns:3000), so including it inopenaiCustomUrlis redundant and breaks the host domain.Actual Higress provider config after initialization:
openai-compat.dns:3000/v110.43.46.12:3000❌ (port included)What I expected
The
openaiCustomUrlshould not include the port. The port should only come fromopenaiCustomServicePort. The "自定义 OpenAI 服务主机域" should be10.43.46.12(without port), and LLM requests should be forwarded to10.43.46.12:3000successfully.Expected Higress provider config:
openai-compat.dns:3000/v110.43.46.12✅ (no port)Steps to Reproduce
Initialize the system: docker version. use one click script
use local ai provider with port such as xx.xx.xxx.xx:3000/v1
AI Analysis
Root Cause
openaiCustomUrlis set to the full base URL (including port) instead of the URL with the port stripped. The port is duplicated — once inopenaiCustomUrl(causing the host domain to include the port) and once inopenaiCustomServicePort.Affected code path 1: Go controller
File:
hiclaw-controller/internal/initializer/initializer.go(~line 362)Affected code path 2: Shell script
File:
manager/scripts/init/setup-higress.sh(~line 221)How it breaks
openaiCustomUrl=http://10.43.46.12:3000/v1(full URL with port)openaiCustomUrl→ displays "自定义 OpenAI 服务主机域" =10.43.46.12:300010.43.46.12:3000as the host domain for DNS resolution / upstream routing10.43.46.12:3000is not a valid DNS hostname → resolution fails → LLM endpoint unreachableSuggested Fix
Strip the port from
openaiCustomUrl. The port should only come fromopenaiCustomServicePort.initializer.go:setup-higress.sh:Related Secondary Bug
ensureServiceSource()andEnsureAIProvider()inhigress.goonly usePOST(treat409 Conflictas success without updating the existing resource). This means even after fixing the code, existing incorrectly configured providers cannot be corrected by re-running the initializer — they must be manually deleted first. The shell scriptsetup-higress.shhandles this correctly withGET → PUT if exists / POST if not, but the Go controller does not.Relevant Logs
Component
Install / Setup
Version / Commit
v1.1.2