Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Don't forward _ping requests to the primary
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne Song committed Nov 28, 2016
1 parent 8657215 commit c064c2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ func (p *Replica) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

// We also handle /_ping locally, but we do so after the primary
// check above.
if strings.HasSuffix(r.URL.Path, "/_ping") {
w.Write([]byte("OK"))
return
}

if err := hijack(p.tlsConfig, p.primary, w, r); err != nil {
httpError(w, fmt.Sprintf("Unable to reach primary cluster manager (%s): %v", err, p.primary), http.StatusInternalServerError)
}
Expand Down

0 comments on commit c064c2b

Please sign in to comment.