π₯ Types of Rules Every DevOps Engineer Must Know¶
Weβll keep it vendor-neutral and production-focused.
1οΈβ£ Redirect Rules¶
Used to send traffic somewhere else.
Example Use Cases:¶
- HTTP β HTTPS
- Old domain β new domain
- Force www β non-www
- Maintenance redirect
Status Codes Used:¶
- 301 (Permanent)
- 302 (Temporary)
- 307 / 308 (Strict method preservation)
Example Logic:¶
2οΈβ£ Rewrite Rules¶
Changes URL internally without redirecting browser.
User sees:
Backend receives:
Used in:
- Clean URLs
- SEO routing
- API version mapping
3οΈβ£ Header Rules¶
Modify request or response headers.
Examples:¶
Add security header:
Add cache control:
Used for:
- Security hardening
- Performance tuning
- CORS handling
4οΈβ£ Cache Rules¶
Control what gets cached.
Examples:¶
Cache only:
Donβt cache:
Important for:
- Performance
- Reducing backend load
- Scaling
5οΈβ£ Rate Limiting Rules¶
Protect against abuse.
Example:
Used for:
- Prevent brute force
- Protect login APIs
- Stop scraping
- Stop DDoS (basic layer)
6οΈβ£ Firewall / WAF Rules¶
Security filtering layer.
Block based on:
- IP
- Country
- User-Agent
- Path
- Bot score
- Request pattern
Example:
Or:
7οΈβ£ Origin Routing Rules¶
Control backend routing.
Example:
Used in:
- Microservices
- Kubernetes ingress
- Multi-server architecture
π₯ Rule Evaluation Order (CRITICAL)¶
This is very important in interviews.
Rules are evaluated:
- Top β Bottom
- First match wins (usually)
So order matters.
If you place:
Rule 1: Redirect all traffic Rule 2: Allow /health
Rule 2 will never execute.
π₯ Common Production Mistakes¶
β Redirect Loop¶
Redirecting HTTP β HTTPS while server already forces HTTPS.
β Blocking Yourself¶
Firewall rule blocks your office IP.
β Caching API Responses¶
Leads to users seeing wrong data.
β Rate limiting Load Balancer Health Checks¶
System marks server unhealthy.
π₯ DevOps Debug Strategy for Rule Issues¶
If something breaks:
- Check redirect status code:
- Check headers:
-
Check rule order
-
Temporarily disable suspicious rule
-
Check logs