Skip to content

www/nginx: Add basic support for forced caching #4481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@
<Required>Y</Required>
<default>1</default>
</cache_min_uses>
<cache_valid type="IntegerField">
<Required>N</Required>
</cache_valid>
Comment on lines +352 to +354
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<cache_valid type="IntegerField">
<Required>N</Required>
</cache_valid>
<cache_valid type="IntegerField"/>

<cache_background_update type="BooleanField">
<Required>Y</Required>
<default>0</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %};
Expand Down