From 7de4d74fbfd1956544d7a5918adb74ddddbc070e Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 7 Jan 2026 20:29:46 +0100 Subject: [PATCH] Invert the x-cache header logic --- docker-compose.yml | 12 +++++++----- nginx.conf | 11 +++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6a95a0a..9b58745 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,12 @@ services: nginx-cache-proxy: - # image: docker.site.quack-lab.dev/nginx-cache-proxy:latest - image: nginx:alpine + # image: nginx:alpine + image: docker.site.quack-lab.dev/nginx-cache-proxy:latest ports: - "3001:3001" volumes: - - ./nginx.conf:/etc/nginx/nginx.conf:ro - - ./nginx-data:/etc/nginx/data - restart: unless-stopped \ No newline at end of file + # - ./nginx.conf:/etc/nginx/nginx.conf:ro + - nginx-data:/etc/nginx/data + +volumes: + nginx-data: \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index a772f99..2977df5 100644 --- a/nginx.conf +++ b/nginx.conf @@ -32,14 +32,13 @@ http { proxy_cache api_cache; proxy_cache_valid 200 365d; - proxy_cache_bypass $http_x_cache_this_inverse; - proxy_no_cache $http_x_cache_this_inverse; + proxy_cache_bypass $http_x_cache_inverse; + proxy_no_cache $http_x_cache_inverse; - set $http_x_cache_this_inverse 1; - if ($http_x_cache_this) { - set $http_x_cache_this_inverse 0; + set $http_x_cache_inverse 1; + if ($http_x_cache) { + set $http_x_cache_inverse 0; } - add_header X-Cache-Status $upstream_cache_status always; } }