A high-performance caching proxy built with Rust, Axum, and Redis to improve response times and reduce API load. Supports persistent caching, compression, rate limiting, and is fully containerized with Docker.
- π§ Features
- π₯ Installation
- π³ Docker Setup
- βοΈ Configuration
- π Usage Examples
- π API Endpoints
- π License
β
Fast caching with Redis (persistent storage)
β
Gzip compression for bandwidth efficiency
β
Configurable cache expiration (TTL)
β
Rate limiting to prevent abuse
β
Detailed logging and monitoring
β
Fully containerized with Docker
Requirements: Rust, Cargo, Redis
# Clone the repository
git clone https://github.com/z7pz/cache-proxy.git
cd cache-proxy
# Install dependencies & build
cargo build --release
# Run the proxy
./target/release/cache-proxy --port 3000 --origin "http://example.com" --cache-ttl 120Requirements: Docker & Docker Compose
# Build and run the container
docker compose up --build -dTo stop:
docker compose downView logs:
docker compose logs -f cache-proxyYou can configure the caching proxy using command-line flags or Docker environment variables.
| Flag / Env Var | Description | Default |
|---|---|---|
--port / $PORT |
Server listening port | 3000 |
--origin / $ORIGIN |
The origin URL to proxy | "http://localhost" |
--cache-ttl / $CACHE_TTL |
Cache expiration time (seconds) | 60 |
--redis-url / $REDIS_URL |
Redis connection URL | "redis://127.0.0.1/" |
--clear-cache |
Clears Redis cache before starting | false |
./cache-proxy --port 8080 --origin "http://example.com" --cache-ttl 120./cache-proxy --clear-cachedocker run -p 3000:3000 -e ORIGIN="http://example.com" -e CACHE_TTL=120 your-image-nameFetches and caches responses from the origin server.
curl -i http://localhost:3000/X-Cache: HIT # Cached response
X-Cache: MISS # New response from originMIT License. Feel free to modify and use! π