mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: support for manipulating HTTP status codes
This commit is contained in:
parent
e2b87f48d6
commit
14b2e71c8c
3 changed files with 40 additions and 0 deletions
|
|
@ -283,6 +283,23 @@
|
|||
<type>text</type>
|
||||
<help><![CDATA[This is suited for all header fields which are allowed to carry more than one value: Matches the specified regular expression against every comma-delimited value of the header field.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
<style>type_table table_http-response_set-status</style>
|
||||
</field>
|
||||
<field>
|
||||
<id>action.http_response_set_status_code</id>
|
||||
<label>HTTP Status Code</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[Replaces the response status code. Must be an integer between 100 and 999.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<id>action.http_response_set_status_reason</id>
|
||||
<label>HTTP Reason Text</label>
|
||||
<type>text</type>
|
||||
<help><![CDATA[An optional custom reason text for the HTTP status code. If empty the default reason for the specified code will be used.]]></help>
|
||||
</field>
|
||||
<field>
|
||||
<label>Parameters</label>
|
||||
<type>header</type>
|
||||
|
|
|
|||
|
|
@ -1528,6 +1528,7 @@
|
|||
<http-response_del-header>http-response header delete</http-response_del-header>
|
||||
<http-response_replace-header>http-response header replace</http-response_replace-header>
|
||||
<http-response_replace-value>http-response header replace value</http-response_replace-value>
|
||||
<http-response_set-status>Set HTTP status code in response</http-response_set-status>
|
||||
<tcp-request_connection_accept>tcp-request connection accept</tcp-request_connection_accept>
|
||||
<tcp-request_connection_reject>tcp-request connection reject</tcp-request_connection_reject>
|
||||
<tcp-request_content_accept>tcp-request content accept</tcp-request_content_accept>
|
||||
|
|
@ -1658,6 +1659,16 @@
|
|||
<mask>/^.{1,4096}$/u</mask>
|
||||
<Required>N</Required>
|
||||
</http_response_replace_value_regex>
|
||||
<http_response_set_status_code type="IntegerField">
|
||||
<MinimumValue>100</MinimumValue>
|
||||
<MaximumValue>999</MaximumValue>
|
||||
<ValidationMessage>Please specify a value between 100 and 999.</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
</http_response_set_status_code>
|
||||
<http_response_set_status_reason type="TextField">
|
||||
<mask>/^.{1,4096}$/u</mask>
|
||||
<Required>N</Required>
|
||||
</http_response_set_status_reason>
|
||||
<tcp_request_content_lua type="TextField">
|
||||
<mask>/^.{1,4096}$/u</mask>
|
||||
<Required>N</Required>
|
||||
|
|
|
|||
|
|
@ -420,6 +420,18 @@
|
|||
{% set action_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif action_data.type == 'http-response_set-status' %}
|
||||
{% if action_data.http_response_set_status_code|default("") != "" %}
|
||||
{% if action_data.http_response_set_status_reason|default("") != "" %}
|
||||
{% set status_reason = ' reason "' ~ action_data.http_response_set_status_reason ~ '"' %}
|
||||
{% else %}
|
||||
{% set status_reason = '' %}
|
||||
{% endif %}
|
||||
{% do action_options.append('http-response set-status ' ~ action_data.http_response_set_status_code ~ status_reason) %}
|
||||
{% else %}
|
||||
{% set action_enabled = '0' %}
|
||||
# ERROR: missing parameters
|
||||
{% endif %}
|
||||
{% elif action_data.type == 'tcp-request_connection_accept' %}
|
||||
{% do action_options.append('tcp-request connection accept') %}
|
||||
{% elif action_data.type == 'tcp-request_connection_reject' %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue