mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
www/nginx: Add basic support for forced caching (#4481)
This commit is contained in:
@@ -96,6 +96,13 @@
|
||||
<advanced>true</advanced>
|
||||
<help>Enter how often the resource must be hit before adding it to the cache.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>location.cache_valid</id>
|
||||
<label>Cache: Force caching time</label>
|
||||
<type>text</type>
|
||||
<advanced>true</advanced>
|
||||
<help>Force caching of 200, 301 and 302 responses according to the request methods enabled for caching. Given in minutes; leave empty to rely on request/response headers from client and upstream.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>location.cache_background_update</id>
|
||||
<label>Cache: Background Update</label>
|
||||
|
||||
@@ -349,6 +349,9 @@
|
||||
<Required>Y</Required>
|
||||
<default>1</default>
|
||||
</cache_min_uses>
|
||||
<cache_valid type="IntegerField">
|
||||
<Required>N</Required>
|
||||
</cache_valid>
|
||||
<cache_background_update type="BooleanField">
|
||||
<Required>Y</Required>
|
||||
<default>0</default>
|
||||
|
||||
@@ -142,6 +142,9 @@ location {{ location.matchtype }} {{ location.urlpattern }} {
|
||||
proxy_cache {{ location.cache_path.replace('-', '') }};
|
||||
{% if location.cache_use_stale is defined and location.cache_use_stale != '' %}
|
||||
proxy_cache_use_stale {{ location.cache_use_stale.replace(',', ' ') }};
|
||||
{% endif %}
|
||||
{% if location.cache_valid is defined and location.cache_valid != '' %}
|
||||
proxy_cache_valid {{ location.cache_valid }}m;
|
||||
{% endif %}
|
||||
proxy_cache_min_uses {{ location.cache_min_uses|default('1') }};
|
||||
proxy_cache_background_update {% if location.cache_background_update is defined and location.cache_background_update == '1' %}on{% else %}off{% endif %};
|
||||
|
||||
Reference in New Issue
Block a user