mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: ensure we are talking to coder on first user check (#11130)
This commit is contained in:
@@ -190,7 +190,15 @@ func (c *Client) HasFirstUser(ctx context.Context) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
// ensure we are talking to coder and not
|
||||
// some other service that returns 404
|
||||
v := res.Header.Get("X-Coder-Build-Version")
|
||||
if v == "" {
|
||||
return false, xerrors.Errorf("missing build version header, not a coder instance")
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
if res.StatusCode != http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user