Overview
Coraza Proxy provides two distinct protection profiles based on the OWASP Core Rule Set (CRS) to optimize security for different application types:- PL1 (Protection Level 1): Designed for HTML websites and static content
- PL2 (Protection Level 2): Designed for JSON APIs with stricter controls
PL1 - Website Protection
PL1 is optimized for traditional web applications serving HTML, CSS, JavaScript, images, and other static assets.Configuration
PL1 uses thepl1-crs-setup.conf profile with these settings:
Key Features
Allowed HTTP MethodsGET,HEAD,POST,OPTIONS
application/x-www-form-urlencodedmultipart/form-data(file uploads)text/plain,text/htmlapplication/json,application/javascripttext/cssimage/*(all image types)
HTTP/1.1,HTTP/2,HTTP/2.0,HTTP/3,HTTP/3.0- Optimized for Cloudflare and modern browsers
- Static file exemptions:
.ico,.png,.jpg,.jpeg,.gif,.svg,.css,.js,.woff,.woff2 - Protocol enforcement disabled for static assets (rules 920100-920499)
- Modern header support:
cf-*,cdn-loop,priority,sec-* - Browser user-agent validation
Anomaly Score Thresholds
- Inbound: 5 points
- Outbound: 4 points
PL1 disables response inspection (
tx.crs_skip_response_analysis=1) to prevent Resource-based Denial of Service (RFDoS) attacks when serving large files.PL2 - API Protection
PL2 provides stricter security controls specifically designed for REST APIs that communicate primarily with JSON.Configuration
PL2 uses thepl2-crs-setup.conf profile with these settings:
Key Features
Allowed HTTP MethodsGET,POST,PUT,PATCH,DELETE,OPTIONS- Full RESTful method support
application/json(primary)application/x-www-form-urlencoded(limited)
HTTP/1.1,HTTP/2- No HTTP/3 by default (can be customized)
Anomaly Score Thresholds
- Inbound: 7 points
- Outbound: 5 points
Choosing the Right Protection Level
Use PL1 When:
- Serving HTML web pages
- Hosting static assets (images, CSS, JavaScript)
- Supporting file uploads
- Using traditional form submissions
- Working with content management systems (WordPress, Drupal, etc.)
- Serving mixed content types
Use PL2 When:
- Building REST APIs
- Accepting only JSON payloads
- Using RESTful methods (PUT, PATCH, DELETE)
- Requiring stricter security controls
- No file upload requirements
- Machine-to-machine communication
Implementation Example
Frommain.go:380-410, the proxy loads both WAF configurations:
Paranoia Levels Explained
Paranoia Level 1 (PL1)
- Security: Balanced protection
- False Positives: Low
- Performance: Optimal
- Use Case: Production websites with diverse traffic
Paranoia Level 2 (PL2)
- Security: Enhanced protection
- False Positives: Moderate
- Performance: Good
- Use Case: APIs with controlled clients
The OWASP CRS supports paranoia levels up to 4. Higher levels (3-4) activate increasingly aggressive rules but may require significant tuning to reduce false positives.
UTF-8 Validation
Both profiles enforce UTF-8 encoding validation:Best Practices
- Start with PL1 for new deployments and monitor false positives
- Use PL2 for APIs where you control client implementations
- Customize profiles based on your specific application requirements
- Monitor audit logs at
/tmp/log/coraza/audit.logto tune rules - Test thoroughly before deploying to production (see Testing Guide)
- Review blocked requests to identify legitimate traffic patterns
