diff --git a/README.md b/README.md index b63f39b..5683832 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,9 @@ alias: None # Array of custom config strings to add to the vhost config, the ";" is added after every entry custom: [] + +# name of the cache to use, only set if not none +cache: None ``` **authconfig** diff --git a/templates/vhost.conf.j2 b/templates/vhost.conf.j2 index 9b968a8..d11c55c 100644 --- a/templates/vhost.conf.j2 +++ b/templates/vhost.conf.j2 @@ -47,7 +47,17 @@ server { {% if location.backend|d(False) %} proxy_pass {{ location.backend }}; + {% if location.cache|d(False) %} + proxy_cache {{ location.cache }}; + proxy_cache_revalidate on; + proxy_cache_lock on; + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; + proxy_cache_background_update on; + # for debugging purposes, add the following header + #add_header X-Cache-Status $upstream_cache_status; + {% else %} proxy_buffering off; + {% endif %} # add proxy headers proxy_set_header Host {{ location.host|d(vhost.host) }};