Apache
Apache proxy design
Define one proxy contract per route: who owns auth, where trust terminates, and how failures move to safe states.
On this page
Doctrine
- Front-end trust must be explicit: proxy only to declared backend pools and documented protocols.
- Set end-to-end timeout, retry, and circuit-breaker policy centrally and review monthly.
- Strip untrusted headers, then add controlled forwarding context headers.
- Separate sticky routing from auth routing to avoid implicit session coupling.
Decision tree
- Is the backend set static or dynamic?
- Static → hardcode pool and validate with active health checks.
- Dynamic → add registry and canary checks before rollout.
- Is this a low-latency or secure-control route?
- Secure-control → enforce stricter retries and short response deadlines.
- Low-latency → conservative buffering and no speculative transforms.
- Did backend failures exceed retry budget?
- Yes → mark host unhealthy and route to fallback behavior.
- No → continue with current pool and emit warning if increasing trend remains.
Diagnostics pathway
- Confirm loaded modules and proxy flags:
apachectl -M | rg -i "proxy|lb|rewrite" - Review backend membership and failover state:
curl -sS http://127.0.0.1/server-status?auto | rg -i "busyworkers|scoreboard|starttime" - Check latency and retry patterns:
curl -I -m 3 https://app.example.com/health - Verify header contract at boundary:
curl -sS -H "X-Diagnostic: 1" https://app.example.com/headers | rg -i "x-forwarded|x-original"
Operational checks
- Before deployment, run at least one negative test for backend unavailable and one retry storm test.
- After deployment, verify all routes still emit identity context and correct host chain.
- Keep a documented rollback: disable `ProxyPass` route, reload Apache, and restore direct endpoint temporarily.