From 77518cee695e72653b5fd0b2c6b77caf015243fb Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Tue, 26 Apr 2022 07:30:34 +0000 Subject: [PATCH] maintenance mode --- README.MD | 1 + haproxy/haproxy.cfg | 4 ++++ haproxy/html/maintenance.html | 26 ++++++++++++++++++++++++++ haproxy/maintenance.map | 0 4 files changed, 31 insertions(+) create mode 100644 haproxy/html/maintenance.html create mode 100644 haproxy/maintenance.map diff --git a/README.MD b/README.MD index 1a411ed..05c93e7 100644 --- a/README.MD +++ b/README.MD @@ -17,6 +17,7 @@ Improvements in this fork: - Cluster toggle, for pow mode only. - Choose protection modes "none", "pow" or "pow+captcha" per-domain or per-domain+path, with paths taking priority. - Whitelist IPs/subnets. +- Maintenance mode page for selected domains. - Include dataplaneapi, to sync map files to disk if edited during runtime. - In POW only mode, provide instructions and an encoded script to find the solution. - Many bugfixes. diff --git a/haproxy/haproxy.cfg b/haproxy/haproxy.cfg index bac0583..521e71e 100644 --- a/haproxy/haproxy.cfg +++ b/haproxy/haproxy.cfg @@ -45,6 +45,10 @@ frontend http-in http-request return file /var/www/js/sha1.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if is_sha1_js http-request return file /var/www/js/worker.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if is_worker_js + # acl for domains in maintenance mode to return maintenance page (after challenge page htp-request return rules, for the footerlogo) + acl maintenance_mode hdr(host),lower,map_str(/etc/haproxy/maintenance.map) -m found + http-request return file /var/www/html/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "cache-control" "private, max-age=30" if maintenance_mode + # create acl for bools updated by lua acl captcha_passed var(txn.captcha_passed) -m bool acl pow_passed var(txn.pow_passed) -m bool diff --git a/haproxy/html/maintenance.html b/haproxy/html/maintenance.html new file mode 100644 index 0000000..99178f6 --- /dev/null +++ b/haproxy/html/maintenance.html @@ -0,0 +1,26 @@ + + + + + Maintenance Mode + + + +

Under maintenance. Please try again soon!

+ + + + diff --git a/haproxy/maintenance.map b/haproxy/maintenance.map new file mode 100644 index 0000000..e69de29