Fix blank lang_json when varnish is up but backend in servers/* is 503 or empty list

This commit is contained in:
Thomas Lynch
2025-04-09 20:05:25 +10:00
parent 70a96bf854
commit 12fc3eb926
2 changed files with 1 additions and 3 deletions

View File

@ -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

View File

@ -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