Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bug Fixes

- Fix debug logs showing empty `Host` for API requests.

### Documentation

### Internal Changes
Expand Down
9 changes: 9 additions & 0 deletions config/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ func HTTPClientConfigFromConfig(cfg *Config) (httpclient.ClientConfig, error) {
if err != nil {
return err
}
// API requests are made with relative paths (e.g. /api/2.0/...).
// r.URL.Host and r.URL.Scheme direct the HTTP client to the right
// server. r.Host sets the Host header explicitly; if r.Host is
// empty, Go copies r.URL.Host into the Host header automatically
// before sending, so both reach the same server — but leaving
// r.Host empty makes debug logs misleadingly show an empty host.
r.URL.Host = url.Host
r.URL.Scheme = url.Scheme
if r.Host == "" {
r.Host = url.Host
}
return nil
},
authInUserAgentVisitor(cfg),
Expand Down
Loading