diff --git a/net/haproxy/pkg-descr b/net/haproxy/pkg-descr
index b29727da1..2b1a0af29 100644
--- a/net/haproxy/pkg-descr
+++ b/net/haproxy/pkg-descr
@@ -13,6 +13,7 @@ Added:
* add new condition: HTTP method
* support custom HTTP status code in "http-request deny" rules
* add new backend option to control PROXY protocol for health checks (#2909)
+* add support for new map file type: reg (#3641)
Changed:
* upgrade to HAProxy 3.2 release series (#5147)
diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogMapfile.xml b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogMapfile.xml
index 76f22f228..8c7d74b41 100644
--- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogMapfile.xml
+++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/forms/dialogMapfile.xml
@@ -11,6 +11,12 @@
text
Description for this map file.
+
+ mapfile.type
+
+ dropdown
+ The type of the map data.
+
mapfile.content
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 a6779063e..4af8285da 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
@@ -2745,6 +2745,14 @@
Should be a string between 1 and 255 characters.
N
+
+ Y
+ dom
+
+ Domains (dom)
+ Regular Expressions (reg)
+
+
Y
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 0bfcb5f3d..01bce3141 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
@@ -459,6 +459,14 @@
{% if action_data.map_use_backend_file|default("") != "" %}
{% set mapfile_data = helpers.getUUID(action_data.map_use_backend_file) %}
{% set mapfile_path = '/tmp/haproxy/mapfiles/' ~ mapfile_data.id ~ '.txt' %}
+{# # Determine map type #}
+{% set mapfile_type = mapfile_data.type %}
+{% if mapfile_data.type|default("") == "reg" %}
+{% set mapfile_config = 'map_' ~ mapfile_type %}
+{% else %}
+{# # Default to map_dom #}
+{% set mapfile_config = 'lower,map_dom' %}
+{% endif %}
{# # Check if a default backend is specified #}
{% if action_data.map_use_backend_default|default("") != "" %}
{% set defaultbackend_data = helpers.getUUID(action_data.map_use_backend_default) %}
@@ -467,7 +475,7 @@
{% set defaultbackend_option = '' %}
{% endif %}
{# # Finally add map file to config #}
-{% do action_options.append('use_backend %[req.hdr(host),lower,map_dom(' ~ mapfile_path ~ defaultbackend_option ~ ')]') %}
+{% do action_options.append('use_backend %[req.hdr(host),' ~ mapfile_config ~ '(' ~ mapfile_path ~ defaultbackend_option ~ ')]') %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters