diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+haskell-git-lfs (1.2.4) unstable; urgency=medium
+
+  * In guessEndpoint, when converting a http URL with a nonstandard
+    port to https, guess the standard https port, rather than
+    trying to use the same nonstandard port.
+
+ -- Joey Hess <id@joeyh.name>  Tue, 18 Feb 2025 13:09:54 -0400
+
 haskell-git-lfs (1.2.3) unstable; urgency=medium
 
   * Expand containers bounds to allow 0.7
diff --git a/Network/GitLFS.hs b/Network/GitLFS.hs
--- a/Network/GitLFS.hs
+++ b/Network/GitLFS.hs
@@ -336,15 +336,20 @@
 -- https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md
 guessEndpoint :: URI.URI -> Maybe Endpoint
 guessEndpoint uri = case URI.uriScheme uri of
-	"https:" -> endpoint
-	"http:" -> endpoint
-	_ -> Nothing
-  where
-	endpoint = mkEndpoint $ uri
+	"https:" -> endpoint uri
+	"http:" -> endpoint $ uri
 		-- force https because the git-lfs protocol uses http
 		-- basic auth tokens, which should not be exposed
 		{ URI.uriScheme = "https:"
-		, URI.uriPath = guessedpath
+		-- use https port, not any nonstandard http port
+		, URI.uriAuthority = do
+			auth <- URI.uriAuthority uri
+			Just $ auth { URI.uriPort = "" }
+		}
+	_ -> Nothing
+  where
+	endpoint uri' = mkEndpoint $ uri'
+		{ URI.uriPath = guessedpath
 		}
 	
 	guessedpath
diff --git a/git-lfs.cabal b/git-lfs.cabal
--- a/git-lfs.cabal
+++ b/git-lfs.cabal
@@ -1,5 +1,5 @@
 Name: git-lfs
-Version: 1.2.3
+Version: 1.2.4
 Cabal-Version: >= 1.10
 License: AGPL-3
 Maintainer: Joey Hess <id@joeyh.name>
