Skip to content

Commit 24d7dc0

Browse files
fix: Fixed the issue where the OpenClaw access address could not be set to a domain name. (#12201)
1 parent 142c9b9 commit 24d7dc0

13 files changed

Lines changed: 33 additions & 50 deletions

File tree

agent/app/service/agents.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,14 @@ func normalizeAllowedOrigin(origin string) (string, error) {
10711071
if pathValue := strings.TrimSpace(parsed.EscapedPath()); pathValue != "" && pathValue != "/" {
10721072
return "", fmt.Errorf("invalid allowed origin: %s", origin)
10731073
}
1074-
if parsed.Port() == "" {
1075-
return "", fmt.Errorf("invalid allowed origin: %s", origin)
1076-
}
10771074
host := parsed.Hostname()
10781075
if strings.Contains(host, ":") {
10791076
host = "[" + host + "]"
10801077
}
1081-
normalized := "https://" + host + ":" + parsed.Port()
1078+
normalized := parsed.Scheme + "://" + host
1079+
if parsed.Port() != "" {
1080+
normalized += ":" + parsed.Port()
1081+
}
10821082
return normalized, nil
10831083
}
10841084

frontend/src/lang/modules/en.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,10 @@ const message = {
681681
webuiPort: 'WebUI Port',
682682
allowedOrigins: 'Access Addresses',
683683
allowedOriginsHelper:
684-
'Enter one full HTTPS access address per line, for example https://192.168.1.2:18789. Fill it manually if the default access address is not configured.',
684+
'Enter one full access address per line. HTTPS is recommended, for example https://192.168.1.2:18789. Fill it manually if the default access address is not configured.',
685685
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
686686
allowedOriginsRequired: 'Enter at least one access address',
687-
allowedOriginsInvalid: 'Use the format http(s)://host-or-ip:port',
688-
allowedOriginsHttpsOnly: 'Access addresses must start with https://',
687+
allowedOriginsInvalid: 'Use the format http(s)://host-or-ip[:port]',
689688
provider: 'Provider',
690689
apiKey: 'API Key',
691690
baseUrl: 'Base URL',

frontend/src/lang/modules/es-es.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,10 @@ const message = {
689689
webuiPort: 'Puerto WebUI',
690690
allowedOrigins: 'Direcciones de acceso',
691691
allowedOriginsHelper:
692-
'Introduce una dirección de acceso HTTPS completa por línea, por ejemplo https://192.168.1.2:18789. Si no hay una dirección predeterminada configurada, rellénala manualmente.',
692+
'Introduce una dirección de acceso completa por línea. Se recomienda usar HTTPS, por ejemplo https://192.168.1.2:18789. Si no hay una dirección predeterminada configurada, rellénala manualmente.',
693693
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
694694
allowedOriginsRequired: 'Introduce al menos una dirección de acceso',
695-
allowedOriginsInvalid: 'Usa el formato http(s)://host-o-ip:puerto',
696-
allowedOriginsHttpsOnly: 'Las direcciones de acceso deben comenzar con https://',
695+
allowedOriginsInvalid: 'Usa el formato http(s)://host-o-ip[:puerto]',
697696
provider: 'Proveedor de modelos',
698697
apiKey: 'Clave API',
699698
baseUrl: 'URL base',

frontend/src/lang/modules/ja.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,10 @@ const message = {
682682
webuiPort: 'WebUI ポート',
683683
allowedOrigins: 'アクセスアドレス',
684684
allowedOriginsHelper:
685-
'1 行に 1 つずつ完全な HTTPS アクセスアドレスを入力してください。例: https://192.168.1.2:18789。デフォルトのアクセスアドレスが未設定の場合は手動で入力してください。',
685+
'1 行に 1 つずつ完全なアクセスアドレスを入力してください。HTTPS を推奨します。例: https://192.168.1.2:18789。デフォルトのアクセスアドレスが未設定の場合は手動で入力してください。',
686686
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
687687
allowedOriginsRequired: '少なくとも 1 つのアクセスアドレスを入力してください',
688-
allowedOriginsInvalid: 'http(s)://host-or-ip:port の形式で入力してください',
689-
allowedOriginsHttpsOnly: 'アクセスアドレスは https:// で始めてください',
688+
allowedOriginsInvalid: 'http(s)://host-or-ip[:port] の形式で入力してください',
690689
provider: 'モデルプロバイダー',
691690
apiKey: 'API キー',
692691
baseUrl: 'ベースURL',

frontend/src/lang/modules/ko.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,10 @@ const message = {
674674
webuiPort: 'WebUI 포트',
675675
allowedOrigins: '접속 주소',
676676
allowedOriginsHelper:
677-
'한 줄에 하나의 전체 HTTPS 접속 주소를 입력하세요. 예: https://192.168.1.2:18789. 기본 접속 주소가 설정되지 않은 경우 수동으로 입력하세요.',
677+
'한 줄에 하나의 전체 접속 주소를 입력하세요. HTTPS 사용을 권장합니다. 예: https://192.168.1.2:18789. 기본 접속 주소가 설정되지 않은 경우 수동으로 입력하세요.',
678678
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
679679
allowedOriginsRequired: '접속 주소를 하나 이상 입력하세요',
680-
allowedOriginsInvalid: 'http(s)://host-or-ip:port 형식으로 입력하세요',
681-
allowedOriginsHttpsOnly: '접속 주소는 https:// 로 시작해야 합니다',
680+
allowedOriginsInvalid: 'http(s)://host-or-ip[:port] 형식으로 입력하세요',
682681
provider: '모델 제공자',
683682
apiKey: 'API 키',
684683
baseUrl: '기본 URL',

frontend/src/lang/modules/ms.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,10 @@ const message = {
689689
webuiPort: 'Port WebUI',
690690
allowedOrigins: 'Alamat akses',
691691
allowedOriginsHelper:
692-
'Masukkan satu alamat akses HTTPS penuh bagi setiap baris, contohnya https://192.168.1.2:18789. Isikan secara manual jika alamat akses lalai belum dikonfigurasi.',
692+
'Masukkan satu alamat akses penuh bagi setiap baris. HTTPS disyorkan, contohnya https://192.168.1.2:18789. Isikan secara manual jika alamat akses lalai belum dikonfigurasi.',
693693
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
694694
allowedOriginsRequired: 'Masukkan sekurang-kurangnya satu alamat akses',
695-
allowedOriginsInvalid: 'Gunakan format http(s)://hos-atau-ip:port',
696-
allowedOriginsHttpsOnly: 'Alamat akses mesti bermula dengan https://',
695+
allowedOriginsInvalid: 'Gunakan format http(s)://hos-atau-ip[:port]',
697696
provider: 'Penyedia model',
698697
apiKey: 'Kunci API',
699698
baseUrl: 'URL asas',

frontend/src/lang/modules/pt-br.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,10 @@ const message = {
684684
webuiPort: 'Porta WebUI',
685685
allowedOrigins: 'Endereços de acesso',
686686
allowedOriginsHelper:
687-
'Informe um endereço de acesso HTTPS completo por linha, por exemplo https://192.168.1.2:18789. Preencha manualmente se o endereço padrão não estiver configurado.',
687+
'Informe um endereço de acesso completo por linha. O uso de HTTPS é recomendado, por exemplo https://192.168.1.2:18789. Preencha manualmente se o endereço padrão não estiver configurado.',
688688
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
689689
allowedOriginsRequired: 'Informe pelo menos um endereço de acesso',
690-
allowedOriginsInvalid: 'Use o formato http(s)://host-ou-ip:porta',
691-
allowedOriginsHttpsOnly: 'Os endereços de acesso devem começar com https://',
690+
allowedOriginsInvalid: 'Use o formato http(s)://host-ou-ip[:porta]',
692691
provider: 'Provedor de modelos',
693692
apiKey: 'Chave API',
694693
baseUrl: 'URL base',

frontend/src/lang/modules/ru.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,10 @@ const message = {
681681
webuiPort: 'Порт WebUI',
682682
allowedOrigins: 'Адреса доступа',
683683
allowedOriginsHelper:
684-
'Указывайте по одному полному HTTPS-адресу доступа в строке, например https://192.168.1.2:18789. Если адрес по умолчанию не настроен, введите его вручную.',
684+
'Указывайте по одному полному адресу доступа в строке. Рекомендуется использовать HTTPS, например https://192.168.1.2:18789. Если адрес по умолчанию не настроен, введите его вручную.',
685685
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
686686
allowedOriginsRequired: 'Укажите хотя бы один адрес доступа',
687-
allowedOriginsInvalid: 'Используйте формат http(s)://host-or-ip:port',
688-
allowedOriginsHttpsOnly: 'Адреса доступа должны начинаться с https://',
687+
allowedOriginsInvalid: 'Используйте формат http(s)://host-or-ip[:port]',
689688
provider: 'Поставщик моделей',
690689
apiKey: 'API ключ',
691690
baseUrl: 'Базовый URL',

frontend/src/lang/modules/tr.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,10 @@ const message = {
685685
webuiPort: 'WebUI portu',
686686
allowedOrigins: 'Erişim adresleri',
687687
allowedOriginsHelper:
688-
'Her satıra bir tam HTTPS erişim adresi girin. Örnek: https://192.168.1.2:18789. Varsayılan erişim adresi yapılandırılmamışsa elle girin.',
688+
'Her satıra bir tam erişim adresi girin. HTTPS kullanmanız önerilir. Örnek: https://192.168.1.2:18789. Varsayılan erişim adresi yapılandırılmamışsa elle girin.',
689689
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
690690
allowedOriginsRequired: 'En az bir erişim adresi girin',
691-
allowedOriginsInvalid: 'http(s)://host-veya-ip:port biçimini kullanın',
692-
allowedOriginsHttpsOnly: 'Erişim adresleri https:// ile başlamalıdır',
691+
allowedOriginsInvalid: 'http(s)://host-veya-ip[:port] biçimini kullanın',
693692
provider: 'Model sağlayıcı',
694693
apiKey: 'API anahtarı',
695694
baseUrl: 'Temel URL',

frontend/src/lang/modules/zh-Hant.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,10 @@ const message = {
649649
webuiPort: 'WebUI 埠',
650650
allowedOrigins: '訪問地址',
651651
allowedOriginsHelper:
652-
'一行一個完整 HTTPS 訪問地址,例如 https://192.168.1.2:18789;未設定預設訪問地址時請手動填寫',
652+
'一行一個完整訪問地址,建議優先使用 HTTPS,例如 https://192.168.1.2:18789;未設定預設訪問地址時請手動填寫',
653653
allowedOriginsPlaceholder: 'https://192.168.1.2:18789',
654654
allowedOriginsRequired: '請至少填寫一個訪問地址',
655-
allowedOriginsInvalid: '訪問地址格式錯誤,請輸入 http(s)://網域或IP:埠',
656-
allowedOriginsHttpsOnly: '訪問地址必須以 https:// 開頭',
655+
allowedOriginsInvalid: '訪問地址格式錯誤,請輸入 http(s)://網域或IP[:埠]',
657656
provider: '模型供應商',
658657
apiKey: 'API Key',
659658
baseUrl: 'Base URL',

0 commit comments

Comments
 (0)