Explorar el Código

move healthcheck before the secret checking (#130)

since health checks on AWS target groups do not support sending headers, it's impossible to use the health check when a secret is configured.
Koen Punt hace 6 años
padre
commit
24562a246f
Se han modificado 1 ficheros con 4 adiciones y 4 borrados
  1. 4 4
      server.go

+ 4 - 4
server.go

@@ -241,16 +241,16 @@ func (h *httpHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
 		panic(errInvalidMethod)
 		panic(errInvalidMethod)
 	}
 	}
 
 
-	if !checkSecret(r) {
-		panic(errInvalidSecret)
-	}
-
 	if r.URL.RequestURI() == healthPath {
 	if r.URL.RequestURI() == healthPath {
 		rw.WriteHeader(200)
 		rw.WriteHeader(200)
 		rw.Write(imgproxyIsRunningMsg)
 		rw.Write(imgproxyIsRunningMsg)
 		return
 		return
 	}
 	}
 
 
+	if !checkSecret(r) {
+		panic(errInvalidSecret)
+	}
+
 	ctx := context.Background()
 	ctx := context.Background()
 
 
 	if newRelicEnabled {
 	if newRelicEnabled {