mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Fix blank lang_json when varnish is up but backend in servers/* is 503 or empty list
This commit is contained in:
@ -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/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 }
|
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
|
# 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 }
|
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 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
|
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
|
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
|
# 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
|
frontend varnish-to-haproxy-internal
|
||||||
bind unix@/shared-sockets/varnish-to-haproxy-internal.sock user root mode 666
|
bind unix@/shared-sockets/varnish-to-haproxy-internal.sock user root mode 666
|
||||||
|
http-request lua.set-lang-json
|
||||||
default_backend servers
|
default_backend servers
|
||||||
|
|
||||||
backend haproxy-to-varnish-cache
|
backend haproxy-to-varnish-cache
|
||||||
|
@ -466,7 +466,6 @@ function _M.set_ip_var(txn, map_name, set_variable, lookup_var)
|
|||||||
local split_names = utils.split(names_list, ":")
|
local split_names = utils.split(names_list, ":")
|
||||||
for _, name in ipairs(split_names) do
|
for _, name in ipairs(split_names) do
|
||||||
if name == current_name or (map_name == "whitelist" and name == "admin") then
|
if name == current_name or (map_name == "whitelist" and name == "admin") then
|
||||||
_M.set_lang_json(txn)
|
|
||||||
txn:set_var(set_variable, true)
|
txn:set_var(set_variable, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user