From 2e2696f797a268c678fa8f99f2cd9dd99395754c Mon Sep 17 00:00:00 2001 From: Andrew McIntosh Date: Fri, 31 Jul 2020 14:58:38 -0400 Subject: [PATCH] Handle termination HTTP signal Provide a method of remotely terminating the proxy. See Issue #77 --- aws-es-proxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws-es-proxy.go b/aws-es-proxy.go index 54bdd575..289914e8 100644 --- a/aws-es-proxy.go +++ b/aws-es-proxy.go @@ -210,6 +210,10 @@ func (p *proxy) getSigner() *v4.Signer { } func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/terminate-proxy" && r.Method == http.MethodPost { + logrus.Infoln("Terminate Signal") + os.Exit(0) + } if p.auth { user, pass, ok := r.BasicAuth()