diff --git a/README.md b/README.md index 5f21dc1..110a425 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,9 @@ OpenSearch --host host.docker.internal:4443 \ --sign-host eu-west-1.es.amazonaws.com ``` - - Access dashboard via http://localhost:8080/_dashboards/app/home#/tutorial_directory +## Healthcheck + +To use healthcheck on ECS or EKS, simply make a call to `localhost:8080/health` which will return the HTTP Status OK. ## Reference diff --git a/handler/handler.go b/handler/handler.go index 01e0faa..6a88691 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -35,7 +35,10 @@ func (h *Handler) write(w http.ResponseWriter, status int, body []byte) { func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { resp, err := h.ProxyClient.Do(r) - if err != nil { + if r.URL.Path == "/health" { + w.WriteHeader(http.StatusOK) + return + } else if err != nil { errorMsg := "unable to proxy request" log.WithError(err).Error(errorMsg) h.write(w, http.StatusBadGateway, []byte(fmt.Sprintf("%v - %v", errorMsg, err.Error())))