new options
This commit is contained in:
@@ -115,16 +115,7 @@ def update_haproxy_config(frontend_name, frontend_ip, frontend_port, lb_method,
|
|||||||
haproxy_cfg.write(f" ssl crt {ssl_cert_path}")
|
haproxy_cfg.write(f" ssl crt {ssl_cert_path}")
|
||||||
|
|
||||||
haproxy_cfg.write("\n")
|
haproxy_cfg.write("\n")
|
||||||
|
|
||||||
# Mode
|
|
||||||
haproxy_cfg.write(f" mode {protocol}\n")
|
|
||||||
|
|
||||||
# ===== HOSTNAME ACL =====
|
|
||||||
acl_name_sanitized = None
|
|
||||||
if frontend_hostname:
|
|
||||||
acl_name_sanitized = f"is_{sanitize_name(frontend_hostname)}"
|
|
||||||
haproxy_cfg.write(f" acl {acl_name_sanitized} hdr(host) -i {frontend_hostname}\n")
|
|
||||||
|
|
||||||
# ===== HTTP-REQUEST RULES (BEFORE REDIRECT) =====
|
# ===== HTTP-REQUEST RULES (BEFORE REDIRECT) =====
|
||||||
|
|
||||||
if is_no_lb:
|
if is_no_lb:
|
||||||
@@ -138,7 +129,16 @@ def update_haproxy_config(frontend_name, frontend_ip, frontend_port, lb_method,
|
|||||||
|
|
||||||
if forward_for:
|
if forward_for:
|
||||||
haproxy_cfg.write(f" option forwardfor\n")
|
haproxy_cfg.write(f" option forwardfor\n")
|
||||||
|
|
||||||
|
# Mode
|
||||||
|
haproxy_cfg.write(f" mode {protocol}\n")
|
||||||
|
|
||||||
|
# ===== HOSTNAME ACL =====
|
||||||
|
acl_name_sanitized = None
|
||||||
|
if frontend_hostname:
|
||||||
|
acl_name_sanitized = f"is_{sanitize_name(frontend_hostname)}"
|
||||||
|
haproxy_cfg.write(f" acl {acl_name_sanitized} hdr(host) -i {frontend_hostname}\n")
|
||||||
|
|
||||||
# DOS protection (BEFORE REDIRECT!)
|
# DOS protection (BEFORE REDIRECT!)
|
||||||
if is_dos:
|
if is_dos:
|
||||||
haproxy_cfg.write(f" stick-table type ip size 1m expire {ban_duration} store http_req_rate(1m)\n")
|
haproxy_cfg.write(f" stick-table type ip size 1m expire {ban_duration} store http_req_rate(1m)\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user