diff --git a/README.md b/README.md index b63f39b5fd321cd6a213e8c3b7fbb012a2e8b90b..56838322a10d8cac56159188f4271310898adb4a 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 9b968a805f9f7749163ab99459658f9974981bae..d11c55cabd44bffc7179c7e560fec6f6ea23b505 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) }};