Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Healthcheck and removes dashboard information #201

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())))
Expand Down