39 lines
923 B
Markdown
39 lines
923 B
Markdown
# Nginx Cache Proxy
|
|
|
|
An nginx proxy server that caches requests only when explicitly requested via the `X-Cache: 1` header.
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Build the image
|
|
./build.sh
|
|
|
|
# Run with docker-compose (uses the built image)
|
|
docker-compose up
|
|
|
|
# Or run directly
|
|
docker run -p 3000:3000 docker.site.quack-lab.dev/nginx-cache-proxy:latest
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Proxy and cache any URL
|
|
curl "http://localhost:3000/?url=https://api.example.com/data"
|
|
```
|
|
|
|
## Features
|
|
|
|
- **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
|
|
|
|
## In n8n
|
|
|
|
Add the `X-Cache: 1` header only to requests you want cached. All other requests will bypass the cache completely.
|