diff --git a/README.md b/README.md index 04abee8..c7faffa 100644 --- a/README.md +++ b/README.md @@ -15,28 +15,21 @@ docker-compose up docker run -p 3000:3000 docker.site.quack-lab.dev/nginx-cache-proxy:latest ``` -## Configuration - -The nginx configuration implements an inverted caching logic: -- **Default behavior**: Requests are NOT cached -- **Cached behavior**: Only requests with `X-Cache: 1` header are cached - ## Usage ```bash -# Proxy a URL +# Proxy and cache any URL curl "http://localhost:3000/?url=https://api.example.com/data" - -# Enable caching with X-Cache header -curl -H "X-Cache: 1" "http://localhost:3000/?url=https://api.example.com/data" ``` ## Features -- Cache path: `/var/cache/nginx` -- Cache zone: `api_cache` (10MB) -- Max cache size: 1GB +- **Always caches** all proxied requests +- Cache path: `/etc/nginx/data/cache` +- Cache zone: `api_cache` (10MB memory) +- Max cache size: 100GB - Cache validity: 365 days for 200 responses +- Max request size: 128MB - Cache status header: `X-Cache-Status` shows cache hit/miss status - HTTPS support with proper SSL/TLS headers diff --git a/nginx.conf b/nginx.conf index 59b187d..da30366 100644 --- a/nginx.conf +++ b/nginx.conf @@ -9,7 +9,7 @@ http { uwsgi_temp_path /etc/nginx/data/temp; scgi_temp_path /etc/nginx/data/temp; - proxy_cache_path /etc/nginx/data/cache levels=1:2 keys_zone=api_cache:10m max_size=1g inactive=365d; + proxy_cache_path /etc/nginx/data/cache levels=1:2 keys_zone=api_cache:10m max_size=100g inactive=365d; error_log /dev/stdout debug; access_log /dev/stdout; @@ -32,13 +32,6 @@ http { proxy_cache api_cache; proxy_cache_valid 200 365d; - proxy_cache_bypass $http_x_cache_inverse; - proxy_no_cache $http_x_cache_inverse; - - 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; } }