mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: add support for map_reg, closes #3641
This commit is contained in:
parent
36ef9648e2
commit
4a03086422
4 changed files with 24 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@
|
|||
<type>text</type>
|
||||
<help>Description for this map file.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>mapfile.type</id>
|
||||
<label>Type</label>
|
||||
<type>dropdown</type>
|
||||
<help>The type of the map data.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>mapfile.content</id>
|
||||
<label>Content</label>
|
||||
|
|
|
|||
|
|
@ -2745,6 +2745,14 @@
|
|||
<ValidationMessage>Should be a string between 1 and 255 characters.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</description>
|
||||
<type type="OptionField">
|
||||
<Required>Y</Required>
|
||||
<Default>dom</Default>
|
||||
<OptionValues>
|
||||
<dom>Domains (dom)</dom>
|
||||
<reg>Regular Expressions (reg)</reg>
|
||||
</OptionValues>
|
||||
</type>
|
||||
<content type="TextField">
|
||||
<Required>Y</Required>
|
||||
</content>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue