Prerequisites
- Docker installed and running
- A backend service to protect (or use a test backend)
- Basic understanding of reverse proxies
This guide uses Docker for the fastest setup. For production deployments or building from source, see the Installation guide.
Quick Setup
Configure Environment
Create a
.env file with your configuration. Here’s a minimal example:.env
Configuration Breakdown
Configuration Breakdown
BACKENDS: JSON mapping of hostnames to backend serversPORT: Port for Coraza Proxy to listen on (default: 8081)PROXY_WEB_HOSTS: Comma-separated list of hosts using PL1 (web) rulesPROXY_RATE_LIMIT: Requests per second per IPPROXY_RATE_BURST: Maximum burst size for rate limiting
Start the Proxy
Run Coraza Proxy with your configuration:Check the logs to verify it started:You should see:
Configuration Examples
Single Backend
Protect a single application:.env
Multiple Hosts
Route different domains to different backends:.env
Path-Based Routing
Route different URL paths to different backends:.env
Path-based routing uses longest prefix matching. A request to
/api/users matches /api before falling back to default.Load Balancing
Distribute traffic across multiple backend servers:.env
Testing Attack Protection
SQL Injection Tests
Cross-Site Scripting (XSS)
Local File Inclusion (LFI)
Remote Command Execution
Log4Shell Detection
Rate Limiting Test
Test the rate limiter by sending rapid requests:429 Too Many Requests after exceeding the configured rate limit.
Monitoring & Logs
Check Audit Logs
Audit logs are written in JSON format:View Debug Logs
For troubleshooting, enable debug logging:.env
Next Steps
Production Configuration
Learn about advanced configuration options and production deployment
Security Testing
Test WAF protection with real attack payloads
Common Issues
Connection Refused to Backend
Connection Refused to Backend
Error:
Bad Gateway: dial tcp: connect: connection refusedSolution: Ensure your backend service is running and accessible from the Docker container. Use Docker service names if running in docker-compose.WAF Not Configured for Host
WAF Not Configured for Host
Error:
WAF not configured for this hostSolution: Add the hostname to either PROXY_WEB_HOSTS or PROXY_APIS_HOSTS depending on whether it should use web or API rules.Too Many False Positives
Too Many False Positives
Issue: Legitimate requests are being blockedSolution:
- Lower the paranoia level in your CRS setup configuration
- Add exclusion rules for specific endpoints
- Use PL2 (API profile) for JSON-heavy endpoints
Rate Limiting Too Strict
Rate Limiting Too Strict
Issue: Users hitting rate limits during normal useSolution: Adjust
PROXY_RATE_LIMIT and PROXY_RATE_BURST: