From 0d713051a2b54510c56530d53bc70fb230895149 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Tue, 14 Oct 2025 23:38:24 -0700 Subject: [PATCH] envconfig: default to port 443 when connecting to ollama.com (#12617) --- envconfig/config.go | 3 +++ envconfig/config_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/envconfig/config.go b/envconfig/config.go index 14c7c61700..d155bd8f93 100644 --- a/envconfig/config.go +++ b/envconfig/config.go @@ -24,6 +24,9 @@ func Host() *url.URL { switch { case !ok: scheme, hostport = "http", s + if s == "ollama.com" { + scheme, hostport = "https", "ollama.com:443" + } case scheme == "http": defaultPort = "80" case scheme == "https": diff --git a/envconfig/config_test.go b/envconfig/config_test.go index f232f1cdc0..ddd86a1147 100644 --- a/envconfig/config_test.go +++ b/envconfig/config_test.go @@ -37,6 +37,7 @@ func TestHost(t *testing.T) { "https": {"https://1.2.3.4", "https://1.2.3.4:443"}, "https port": {"https://1.2.3.4:4321", "https://1.2.3.4:4321"}, "proxy path": {"https://example.com/ollama", "https://example.com:443/ollama"}, + "ollama.com": {"ollama.com", "https://ollama.com:443"}, } for name, tt := range cases {