You've already forked imgproxy
mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-11-29 23:07:40 +02:00
add /health endpoint
Returns 200 OK after server starts. This greatly simplifies container deployment. For example, Kubernetes can be configured to not route traffic to imgproxy Pods that did not pass Readiness check against /health.
This commit is contained in:
@@ -175,6 +175,12 @@ func (h *httpHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
panic(invalidSecretErr)
|
||||
}
|
||||
|
||||
if r.URL.Path == "/health" {
|
||||
rw.WriteHeader(200);
|
||||
rw.Write([]byte("imgproxy is running"));
|
||||
return
|
||||
}
|
||||
|
||||
imgURL, procOpt, err := parsePath(r)
|
||||
if err != nil {
|
||||
panic(newError(404, err.Error(), "Invalid image url"))
|
||||
|
||||
Reference in New Issue
Block a user