mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Solved proxy cache bugs
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
- name: Remove (Cleanup) NGINX cache directory contents
|
||||
become: true
|
||||
file:
|
||||
path: "{{ nginx.directories.cache }}"
|
||||
state: absent
|
||||
when:
|
||||
- mode_cleanup | bool
|
||||
- run_once_nginx_reverse_proxy is not defined
|
||||
|
||||
- name: Ensure NGINX cache directory exists
|
||||
become: true
|
||||
file:
|
||||
path: "{{ nginx.directories.cache }}"
|
||||
state: directory
|
||||
owner: http
|
||||
group: http
|
||||
mode: '0755'
|
||||
when: run_once_nginx_reverse_proxy is not defined
|
||||
|
||||
- name: run the nginx_reverse_proxy tasks once
|
||||
set_fact:
|
||||
run_once_nginx_reverse_proxy: true
|
||||
when: run_once_nginx_reverse_proxy is not defined
|
@@ -1,16 +1,10 @@
|
||||
proxy_cache_path {{ nginx.directories.cache }} levels=1:2 keys_zone=imgcache:10m inactive=60m use_temp_path=off;
|
||||
|
||||
{%- if location is defined %}
|
||||
location ~* ^{{ location }}.*\.(jpg|jpeg|png|gif|webp|ico|svg)$ {
|
||||
{%- else %}
|
||||
location ~* \.(jpg|jpeg|png|gif|webp|ico|svg)$ {
|
||||
{%- endif %}
|
||||
# Cache in browser
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||
|
||||
# Cache on reverse proxy side
|
||||
proxy_pass http://127.0.0.1:{{http_port}}{{location | default("/")}};
|
||||
proxy_pass http://127.0.0.1:{{http_port}};
|
||||
proxy_cache imgcache;
|
||||
proxy_cache_valid 200 302 60m;
|
||||
proxy_cache_valid 404 1m;
|
||||
|
Reference in New Issue
Block a user