From b88b6251f928a4ff8033c0f5894e30a77daf3c3c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 27 Jan 2026 15:42:46 +0100 Subject: [PATCH] Add support for X-Ccache-Purge to well... --- nginx.conf | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/nginx.conf b/nginx.conf index c848f96..1face2c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -32,7 +32,7 @@ http { if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH"; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-NoCache,X-Status"; + add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-Cache-Purge,X-Status"; add_header Access-Control-Max-Age 86400; return 204; } @@ -96,7 +96,7 @@ http { # CORS headers — replace with our own * add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH" always; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-NoCache,X-Status" always; + add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-Cache-Purge,X-Status" always; add_header Access-Control-Expose-Headers "X-Cache-Status" always; proxy_cache api_cache; @@ -106,12 +106,11 @@ http { # Ignore headers that would prevent storing the response proxy_ignore_headers Cache-Control Expires Set-Cookie Vary X-Accel-Expires X-Accel-Redirect; - # Bypass cache for this request (and do not store): send X-NoCache or X-Cache-Invalidate (any value) - set $skip_cache 0; - if ($http_x_nocache != "") { set $skip_cache 1; } - if ($http_x_cache_invalidate != "") { set $skip_cache 1; } - proxy_cache_bypass $skip_cache; - proxy_no_cache $skip_cache; + # X-Cache-Purge: bypass cache for this request (don't serve cached) but DO store the new response (overwrites that key) + set $bypass_cache 0; + if ($http_x_cache_purge != "") { set $bypass_cache 1; } + proxy_cache_bypass $bypass_cache; + proxy_no_cache 0; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;