mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
www/caddy: Add Request Matcher option to Access List (#4680)
* www/caddy: Add Request Matcher option to Access List * www/caddy: Bump model version
This commit is contained in:
@@ -44,6 +44,13 @@
|
||||
<visible>false</visible>
|
||||
</grid_view>
|
||||
</field>
|
||||
<field>
|
||||
<id>accesslist.RequestMatcher</id>
|
||||
<label>Request Matcher</label>
|
||||
<type>dropdown</type>
|
||||
<help><![CDATA[Set the request matcher that will be applied to this access list.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>accesslist.description</id>
|
||||
<label>Description</label>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<model>
|
||||
<mount>//Pischem/caddy</mount>
|
||||
<description>Caddy Reverse Proxy</description>
|
||||
<version>1.3.5</version>
|
||||
<version>1.3.6</version>
|
||||
<items>
|
||||
<general>
|
||||
<enabled type="BooleanField">
|
||||
@@ -530,6 +530,14 @@
|
||||
<ValidationMessage>Please enter a valid HTTP response code between 100 and 599</ValidationMessage>
|
||||
</HttpResponseCode>
|
||||
<HttpResponseMessage type="DescriptionField"/>
|
||||
<RequestMatcher type="OptionField">
|
||||
<Required>Y</Required>
|
||||
<Default>client_ip</Default>
|
||||
<OptionValues>
|
||||
<client_ip>client_ip</client_ip>
|
||||
<remote_ip>remote_ip</remote_ip>
|
||||
</OptionValues>
|
||||
</RequestMatcher>
|
||||
<description type="DescriptionField"/>
|
||||
</accesslist>
|
||||
<basicauth type="ArrayField">
|
||||
|
||||
@@ -524,7 +524,7 @@ http://{{ domain }} {
|
||||
{% set client_ips = accesslist_obj.clientIps.split(',') | join(' ') %}
|
||||
{{ unique_identifier }} {
|
||||
{# Non-inverted access lists have "not" as default, inverted ones '' #}
|
||||
{{ 'not' if accesslist_obj.accesslistInvert|default("0") == "0" else '' }} client_ip {{ client_ips }}
|
||||
{{ 'not' if accesslist_obj.accesslistInvert|default("0") == "0" else '' }} {{ accesslist_obj.RequestMatcher }} {{ client_ips }}
|
||||
}
|
||||
{# When IP is matched, abort or send response code. This will end processing and drop the request #}
|
||||
handle {{ unique_identifier }} {
|
||||
|
||||
Reference in New Issue
Block a user