diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml
index 27b397f94..3c3e1dae4 100644
--- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml
+++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogHealthcheck.xml
@@ -23,6 +23,13 @@
text
+
+ healthcheck.checkport
+
+ text
+
+ true
+
header
diff --git a/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml
index f537931d2..7f2e10bd6 100644
--- a/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml
+++ b/net/haproxy/src/opnsense/mvc/app/models/OPNsense/HAProxy/HAProxy.xml
@@ -549,7 +549,7 @@
Y
- 80
+
1
65535
Please specify a value between 1 and 65535.
@@ -624,6 +624,13 @@
Please specify a value between 250 and 1000000.
N
+
+
+ 1
+ 65535
+ Please specify a value between 1 and 65535.
+ N
+
N
diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
index 91cc336d4..555e688f6 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
@@ -652,7 +652,7 @@ backend {{backend.name}}
{# # health check option #}
{% set healthcheck_options = [] %}
{% if healthcheck_data.type|default("") == "" %}
-{% set healthcheck_enabled = '1' %}
+{% set healthcheck_enabled = '0' %}
{% elif healthcheck_data.type == 'tcp' %}
{# # TCP check does not require additional options #}
{% elif healthcheck_data.type == 'http' %}
@@ -763,15 +763,21 @@ backend {{backend.name}}
{% if backend.tuning_defaultserver|default("") != "" %}
default-server {{backend.tuning_defaultserver}}
{% endif %}
-
{% for server in backend.linkedServers.split(",") %}
{% set server_data = helpers.getUUID(server) %}
{# # collect optional server parameters #}
{% set server_options = [] %}
-{# if# check if health check is enabled #}("") != "" %}
+{# # check if health check is enabled #}
{% if healthcheck_enabled == '1' %}
{% do server_options.append('check') %}
{% do server_options.append('inter ' ~ server_data.checkInterval) %}
+{# # use a different port for health check #}
+{% if healthcheck_data.checkport|default("") != "" %}
+{# # prefer port from health check template #}
+{% do server_options.append('port ' ~ healthcheck_data.checkport) %}
+{% elif server_data.checkport|default("") != "" %}
+{% do server_options.append('port ' ~ server_data.checkport) %}
+{% endif %}
{# # add all additions from healthchecks here #}
{% do server_options.append(healthcheck_additions|join(' ')) if healthcheck_additions.length != '0' %}
{% endif %}