Skip to main content

Request & Response Transforms

Aegis supports ordered, conditional transform rules that modify requests before they reach the upstream and responses before they are returned to the client. Transforms are configured per proxy host and executed in a user-defined sort order.
Image

Capabilities


Transform Phases

Each rule targets either the request or response phase:

Request Actions


Response Actions


Variable Expansion

Header values and URLs support ${variable} placeholders that are substituted at runtime:

Conditional Execution

Every transform rule can optionally include one or more conditions using the same condition engine as Custom WAF Rules. Conditions use AND logic — all conditions must match for the transform to execute. This enables patterns like:
  • Set X-Forwarded-User only when a valid OAuth session is present
  • Rewrite paths only for specific User-Agent strings
  • Add CORS headers only for requests from allowed origins
  • Redirect HTTP to HTTPS only for non-API paths
Response-phase transforms can also condition on response properties:
  • Remove Server header only when the response status is 2xx
  • Add Cache-Control only when Content-Type matches a specific pattern

Path Rewriting

Path rewriting supports two modes:

Literal Replacement

Replace the first occurrence of path_match with path_replace: /api/v1/users becomes /api/v2/users.

Regex Replacement

Enable path_regex to use RE2 regex with capture groups: /app/settings/profile becomes /dashboard/settings/profile.

Built-in Templates

The admin UI provides preset templates for common transform patterns:

Execution Order

Transforms execute in sort-order sequence within each phase. The UI supports drag-to-reorder, and the API accepts an ordered list of rule IDs:
Request transforms run before the request is forwarded. If a redirect action fires, it short-circuits the chain — no further transforms or proxying occurs.

API Reference

Transform Rule Schema

Transform Config Schema