diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index 9d9b93e..5b663c4 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -293,6 +293,11 @@ func (p *Proxy) forwardRequest(acct *account.Account, w http.ResponseWriter, req func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request) { log.Info("Received %s request for %s", req.Method, req.URL.Path) + if req.URL.Path == "/health" { + p.handleHealthCheck(w, req) + return + } + acct, err := getAccount(req) if err != nil { writeJSONError(w, http.StatusForbidden, err) @@ -331,6 +336,15 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request) { p.forwardRequest(acct, w, req) } +func (p *Proxy) handleHealthCheck(w http.ResponseWriter, req *http.Request) { + if req.Method != http.MethodGet { + writeJSONError(w, http.StatusMethodNotAllowed, nil) + return + } + w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) +} + func (p *Proxy) handleFleetTelemetryConfig(acct *account.Account, w http.ResponseWriter, req *http.Request) { log.Info("Processing fleet telemetry configuration...") defer func() {