diff --git a/agent/http.go b/agent/http.go index 3e95a9722..8c7b4b22b 100644 --- a/agent/http.go +++ b/agent/http.go @@ -417,6 +417,14 @@ func setTranslateAddr(resp http.ResponseWriter, active bool) { // setIndex is used to set the index response header func setIndex(resp http.ResponseWriter, index uint64) { + // If we ever return X-Consul-Index of 0 blocking clients will go into a busy + // loop and hammer us since ?index=0 will never block. It's always safe to + // return index=1 since the very first Raft write is always an internal one + // writing the raft config for the cluster so no user-facing blocking query + // will ever legitimately have an X-Consul-Index of 1. + if index == 0 { + index = 1 + } resp.Header().Set("X-Consul-Index", strconv.FormatUint(index, 10)) } diff --git a/connect/resolver.go b/connect/resolver.go index b65bada06..f2e574553 100644 --- a/connect/resolver.go +++ b/connect/resolver.go @@ -172,7 +172,7 @@ func (cr *ConsulResolver) resolveServiceEntry(entry *api.ServiceEntry) (string, port := entry.Service.Port service := entry.Service.Service - if !entry.Service.Connect.Native { + if entry.Service.Connect != nil && !entry.Service.Connect.Native { service = entry.Service.ProxyDestination }