diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..41db0ec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +cache/ +cache2/ +cache16a/ +cache16c/ +cache21/ +servroot/ +perfcache/ +bgcache/ +concurrent/ +throttle/ +t/servroot/ +t/cache/ +t/cache2/ +t/cache16a/ +t/cache16c/ +t/cache21/ +t/perfcache/ +t/bgcache/ +t/concurrent/ +t/throttle/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 426a572..3a5ebdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,6 +183,8 @@ jobs: sudo apt-get update && sudo apt-get install -y cppcheck cppcheck --enable=all --inconclusive --std=c89 \ --suppress=missingIncludeSystem \ + --suppress=toomanyconfigs \ + --suppress=checkersReport \ --error-exitcode=1 \ ngx_cache_purge_module.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e458ed5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.worktrees/ diff --git a/README.md b/README.md index fe7af8b..9ca3448 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,12 @@ matches the purge request. | nginx | status | |--------|------------| | 1.20.x | ✓ tested | +| 1.22.x | ✓ tested | +| 1.24.x | ✓ tested | | 1.26.x | ✓ tested | | 1.28.x | ✓ tested | -| 1.29.x | ✓ tested | +| latest stable | ✓ tested | +| latest mainline | ✓ tested | Older releases back to 1.7.9 compile but are not covered by CI. @@ -270,6 +273,312 @@ match will not align with the stored key. ## Sample configurations +## Refresh (conditional cache validation) + +Instead of blindly purging matched cache entries, `refresh` sends conditional +`HEAD` subrequests upstream using `If-None-Match` / `If-Modified-Since` +headers extracted from each cached file. Entries that return `200` are +purged; entries that return `304` are kept. + +Refresh currently supports `proxy_cache` only. Attempting refresh on +`fastcgi`, `scgi`, or `uwsgi` caches returns `400 Bad Request`. + +### Refresh directives + +`proxy_cache_refresh` + +``` +Syntax: proxy_cache_refresh [refresh_all] [from all| [.. ]] +Default: none +Context: http, server, location +``` + +Enables refresh mode with a dedicated directive. The first argument is the +HTTP method used to trigger refresh requests, for example `REFRESH`. Optional +`refresh_all` enables full-zone refresh. + +The legacy `refresh` parameter on `proxy_cache_purge` is removed; use +`proxy_cache_refresh` instead. + +`proxy_cache_refresh` and `proxy_cache_purge` cannot be configured together in +the same `location`. If you need both actions, expose separate endpoints such as +`/purge/...` and `/refresh/...`. + +`cache_purge_refresh_timeout` + +``` +Syntax: cache_purge_refresh_timeout