net/haproxy: add 2 new cache parameters, closes #2908

This commit is contained in:
Jan Winkler
2022-08-09 15:11:45 +02:00
parent ce1995a585
commit 996c01166d
3 changed files with 30 additions and 0 deletions
@@ -27,4 +27,16 @@
<type>text</type>
<help><![CDATA[Define the maximum size of the objects to be cached. Must not be greater than an half of the maximum size of the cache. If not set, it equals to a 256th of the cache size. All objects with sizes larger than this value will not be cached.]]></help>
</field>
<field>
<id>haproxy.general.cache.processVary</id>
<label>Process vary enabled</label>
<type>checkbox</type>
<help><![CDATA[Enable or disable the processing of the Vary header. When disabled, a response containing such a header will never be cached.]]></help>
</field>
<field>
<id>haproxy.general.cache.maxSecondaryEntries</id>
<label>Maximum Number of secondary entries</label>
<type>text</type>
<help><![CDATA[To add this cache parameter Vary support needs to be enabled. Define the maximum number of simultaneous secondary entries with the same primary key in the cache. Its default value is 10 and should be passed a strictly positive integer.]]></help>
</field>
</form>
@@ -402,6 +402,16 @@
<Required>N</Required>
<ValidationMessage>Please specify a value between 1 and 2146435072.</ValidationMessage>
</maxObjectSize>
<processVary type="BooleanField">
<default>0</default>
<Required>N</Required>
</processVary>
<maxSecondaryEntries type="IntegerField">
<default>10</default>
<MinimumValue>1</MinimumValue>
<Required>N</Required>
<ValidationMessage>Please specify a positive integer value.</ValidationMessage>
</maxSecondaryEntries>
</cache>
</general>
<frontends>
@@ -1062,6 +1062,14 @@ cache opnsense-haproxy-cache
{% if OPNsense.HAProxy.general.cache.maxObjectSize|default("") != "" %}
max-object-size {{OPNsense.HAProxy.general.cache.maxObjectSize}}
{% endif %}
{% if OPNsense.HAProxy.general.cache.processVary|default("") == "1" %}
process-vary on
{% if OPNsense.HAProxy.general.cache.maxSecondaryEntries|default("") != "" %}
max-secondary-entries {{OPNsense.HAProxy.general.cache.maxSecondaryEntries}}
{% endif %}
{% else %}
process-vary off
{% endif %}
{%- endif -%}
{# ############################### #}