summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.docker/web-nginx/nginx.conf2
-rw-r--r--classes/Config.php4
-rw-r--r--classes/Handler_Public.php6
3 files changed, 11 insertions, 1 deletions
diff --git a/.docker/web-nginx/nginx.conf b/.docker/web-nginx/nginx.conf
index c85e46ef3..9e2298897 100644
--- a/.docker/web-nginx/nginx.conf
+++ b/.docker/web-nginx/nginx.conf
@@ -34,6 +34,8 @@ http {
internal;
}
+ rewrite ${APP_BASE}/healthz ${APP_BASE}/public.php?op=healthcheck;
+
location ~ \.php$ {
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
diff --git a/classes/Config.php b/classes/Config.php
index 72d6c5106..2c2cd4d65 100644
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -643,7 +643,9 @@ class Config {
}
}
- if (count($errors) > 0 && php_sapi_name() != "cli") { ?>
+ if (count($errors) > 0 && php_sapi_name() != "cli") {
+ http_response_code(503); ?>
+
<!DOCTYPE html>
<html>
<head>
diff --git a/classes/Handler_Public.php b/classes/Handler_Public.php
index 8134eeff2..d0e434c8e 100644
--- a/classes/Handler_Public.php
+++ b/classes/Handler_Public.php
@@ -834,5 +834,11 @@ class Handler_Public extends Handler {
exit;
}
+ // implicit Config::sanity_check() does the actual checking */
+ public function healthcheck() {
+ header("Content-Type: text/plain");
+ print "OK";
+ }
+
}
?>