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
Mixed case GITHUB_HOST is classified as GitHub Enterprise Server #3524
--gh-host / GITHUB_HOST values are classified with an exact, case sensitive comparison against github.com and ghe.com. A host that differs only in letter case is treated as a GitHub Enterprise Server instance, so the server builds GHES style URLs for it.
For example:
Input
REST URL built today
Expected
https://GitHub.com
https://GitHub.com/api/v3/
https://api.github.com/
https://Contoso.GHE.com
https://Contoso.GHE.com/api/v3/
https://api.Contoso.GHE.com/
The GraphQL, upload, raw and authorization server URLs are derived the same way, so every API call fails. Classification as GHES also triggers the subdomain isolation probe against raw.<host>/_ping, and ParseHostType reports HostTypeGHES, which changes which host specific capabilities are enabled.
A data residency tenant whose subdomain is written with a capital letter, as company names often are (https://Contoso.ghe.com), is enough to hit this.
What should happen
Host names are case insensitive (RFC 4343), so https://GitHub.com should behave like https://github.com, and https://Contoso.GHE.com like https://contoso.ghe.com. isLoopbackHost in the same file already lowercases the host before comparing.
Repro
host, _:=utils.NewAPIHost("https://GitHub.com")
u, _:=host.BaseRESTURL(context.Background())
fmt.Println(u) // https://GitHub.com/api/v3/
Root cause
classifyHost in pkg/utils/api.go compares u.Hostname() directly. net/url lowercases the scheme but keeps the host as written, so the github.com and ghe.com checks never match a mixed case host.
Activity