Skip to Content
Advanced FeaturesDynamic Interceptors

Dynamic Interceptors

APXY provides Dynamic Interceptors — a programmable system for matching traffic and applying transformations using a DSL (Domain-Specific Language). Unlike static mock rules, interceptors support conditional logic and can modify requests and responses on-the-fly.

Paid feature — requires a license with interceptor editing capability.

Web UI

Open Interceptors from the Modify group. The page provides:

  • A form to create interceptors with Name, Match Expression (DSL syntax), Action dropdown (mock / modify / observe), and optional Transform fields for headers, status, body, and delay
  • A list of active interceptors with enable/disable toggles
  • Delete buttons for each interceptor

CLI

There is no apxy … subcommand for interceptors in the current CLI. Use the Web UI (ModifyInterceptors) to create, list, enable, disable, and delete interceptors. The UI talks to the same control API that other clients can call programmatically.

Related automation (mock, rewrite, script, breakpoint, filter, network) is covered in the CLI Reference.

Match Expression DSL

Match expressions filter traffic based on request/response properties:

host == api.example.com path contains /api/v2/ method == POST status >= 400 url matches .*\.json$ header:Content-Type contains json

Combine with && (AND) and || (OR):

host == api.example.com && method == POST path contains /users || path contains /accounts

Special values: * or true match everything.

Actions

ActionDescription
mockReturn a fake response without forwarding to the server
modifyForward to the server but alter the request or response
observeForward normally and log the match (no transformation)

Transform Options

When using mock or modify actions, you can specify transforms:

FieldDescription
set_request_headersOverwrite request headers
set_response_headersOverwrite response headers
set_response_statusOverride response status code
set_response_bodyOverride response body
add_request_headersAdd headers without overwriting
remove_headersHeader names to remove
delay_msDelay before responding

Use Cases

Add debug headers to staging requests

Create an interceptor in the Web UI with Action set to modify, Match set to host == staging.example.com, and add a request header transform such as X-Debug-Proxy: true.

Log all POST requests

Create an interceptor with Action observe and Match method == POST so matching requests are tagged without changing behavior.

Last updated on