From 12fc3eb92658d65c3c049f09796f72ebaa9246f2 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Wed, 9 Apr 2025 20:05:25 +1000 Subject: [PATCH] Fix blank lang_json when varnish is up but backend in servers/* is 503 or empty list --- haproxy/haproxy.cfg | 3 +-- src/lua/scripts/bot-check.lua | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/haproxy/haproxy.cfg b/haproxy/haproxy.cfg index d81ab22..2434661 100644 --- a/haproxy/haproxy.cfg +++ b/haproxy/haproxy.cfg @@ -128,7 +128,6 @@ frontend http-in http-request return file /etc/haproxy/js/bc.js status 200 content-type "application/javascript; charset=utf-8" hdr "Cache-Control" "public, max-age=86400" if { path /.basedflare/js/bc.js } http-request return file /etc/haproxy/js/bm.min.js status 200 content-type "application/javascript; charset=utf-8" hdr "Cache-Control" "public, max-age=86400" if { path /.basedflare/js/bm.min.js } - # rewrite specific domain+path to domain or domain+path http-request redirect location https://%[base,map(/etc/haproxy/map/rewrite.map)] code 302 if { base,map(/etc/haproxy/map/rewrite.map) -i -m found } @@ -152,7 +151,6 @@ frontend http-in # 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/map/maintenance.map) -m found - http-request lua.set-lang-json http-request return lf-file /etc/haproxy/template/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "Cache-Control" "private, max-age=30" if maintenance_mode # optional alt-svc header (done after cache so not set in cached responses @@ -169,6 +167,7 @@ frontend http-in frontend varnish-to-haproxy-internal bind unix@/shared-sockets/varnish-to-haproxy-internal.sock user root mode 666 + http-request lua.set-lang-json default_backend servers backend haproxy-to-varnish-cache diff --git a/src/lua/scripts/bot-check.lua b/src/lua/scripts/bot-check.lua index 1664f29..f02866b 100644 --- a/src/lua/scripts/bot-check.lua +++ b/src/lua/scripts/bot-check.lua @@ -466,7 +466,6 @@ function _M.set_ip_var(txn, map_name, set_variable, lookup_var) local split_names = utils.split(names_list, ":") for _, name in ipairs(split_names) do if name == current_name or (map_name == "whitelist" and name == "admin") then - _M.set_lang_json(txn) txn:set_var(set_variable, true) return end