diff --git a/README.md b/README.md index 9dd0007c..64a43b1e 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,10 @@ You can find helpful code snippets in the `examples` folder. imgproxy supports only the most popular image formats of the moment: PNG, JPEG, GIF and WebP. +## Deployment + +There is a special endpoint `/health`, which returns HTTP Status `200 OK` after server successfully starts. This can be used to check container readiness. + ## Author Sergey "DarthSim" Aleksandrovich diff --git a/server.go b/server.go index 0cda2475..97ba6765 100644 --- a/server.go +++ b/server.go @@ -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"))