summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/load-balancing/haproxy.cfg.j23
-rw-r--r--interface-definitions/load-balancing_haproxy.xml.in6
-rw-r--r--src/conf_mode/load-balancing_haproxy.py7
3 files changed, 15 insertions, 1 deletions
diff --git a/data/templates/load-balancing/haproxy.cfg.j2 b/data/templates/load-balancing/haproxy.cfg.j2
index c6729fda4..438796cee 100644
--- a/data/templates/load-balancing/haproxy.cfg.j2
+++ b/data/templates/load-balancing/haproxy.cfg.j2
@@ -206,6 +206,9 @@ backend {{ back }}
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
+{% if back_config.http_server_close is vyos_defined %}
+ option http-server-close
+{% endif %}
{% endif %}
{% if back_config.logging is vyos_defined %}
{% for facility, facility_config in back_config.logging.facility.items() %}
diff --git a/interface-definitions/load-balancing_haproxy.xml.in b/interface-definitions/load-balancing_haproxy.xml.in
index e9d42ef90..8111d7506 100644
--- a/interface-definitions/load-balancing_haproxy.xml.in
+++ b/interface-definitions/load-balancing_haproxy.xml.in
@@ -225,6 +225,12 @@
</constraint>
</properties>
</leafNode>
+ <leafNode name="http-server-close">
+ <properties>
+ <help>Enable HTTP/1.x connection closing on the server side</help>
+ <valueless/>
+ </properties>
+ </leafNode>
#include <include/haproxy/rule-backend.xml.i>
<tagNode name="server">
<properties>
diff --git a/src/conf_mode/load-balancing_haproxy.py b/src/conf_mode/load-balancing_haproxy.py
index 0f31880ba..f95d05151 100644
--- a/src/conf_mode/load-balancing_haproxy.py
+++ b/src/conf_mode/load-balancing_haproxy.py
@@ -149,7 +149,12 @@ def verify(lb):
for group in ['service', 'backend']:
for config_name, config in lb[group].items():
if 'http_response_headers' in config and config['mode'] != 'http':
- raise ConfigError(f'{group} {config_name} must be set to http mode to use http_response_headers!')
+ raise ConfigError(f'{group} {config_name} must be set to http mode to use http-response headers!')
+
+ # Check if http-server-close is configured in any backend where mode != http
+ for config_name, config in lb['backend'].items():
+ if 'http_server_close' in config and config['mode'] != 'http':
+ raise ConfigError(f'backend {config_name} must be set to http mode to use http-server-close!')
def generate(lb):