Fix expired node registration URL

This commit is contained in:
Juan Font Alonso 2022-08-13 21:17:05 +02:00
parent 09cd7ba304
commit a7efc22045

4
api.go
View file

@ -605,8 +605,8 @@ func (h *Headscale) handleMachineExpired(
resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s", resp.AuthURL = fmt.Sprintf("%s/oidc/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"), machineKey.String()) strings.TrimSuffix(h.cfg.ServerURL, "/"), machineKey.String())
} else { } else {
resp.AuthURL = fmt.Sprintf("%s/register?key=%s", resp.AuthURL = fmt.Sprintf("%s/register/%s",
strings.TrimSuffix(h.cfg.ServerURL, "/"), machineKey.String()) strings.TrimSuffix(h.cfg.ServerURL, "/"), NodePublicKeyStripPrefix(registerRequest.NodeKey))
} }
respBody, err := encode(resp, &machineKey, h.privateKey) respBody, err := encode(resp, &machineKey, h.privateKey)