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

  1. Doctrine
  2. Decision tree
  3. Diagnostics pathway
  4. Operational checks
  5. Related routes

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

  1. Is the backend set static or dynamic?
    • Static → hardcode pool and validate with active health checks.
    • Dynamic → add registry and canary checks before rollout.
  2. 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.
  3. 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

  1. Confirm loaded modules and proxy flags:
    apachectl -M | rg -i "proxy|lb|rewrite"
  2. Review backend membership and failover state:
    curl -sS http://127.0.0.1/server-status?auto | rg -i "busyworkers|scoreboard|starttime"
  3. Check latency and retry patterns:
    curl -I -m 3 https://app.example.com/health
  4. 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.