Skip to Content

apxy rules

Manage mock rules, redirects, interceptors, breakpoints, caching, network conditions, and scripting.

apxy mock

Create and manage mock response rules.

apxy mock add

Create a mock response rule that intercepts matching requests and returns a canned response.

apxy mock add [flags]

Examples:

apxy mock add --name "mock-users" --url "https://api.example.com/users" \ --method GET --status 200 --body '{"users":[]}' apxy mock add --name "stripe-card-decline" --url "https://api.stripe.com/v1/payment_intents/*/confirm" \ --match wildcard --method POST --header-conditions "X-APXY-Scenario=card_declined" \ --headers "Content-Type=application/json,Request-Id=req_test_123" \ --status 402 --body '{"error":{"type":"card_error","code":"card_declined"}}' apxy mock add --name "slow-api" --url "https://api.example.com/*" \ --match wildcard --status 200 --body '{}' --delay 2000
FlagTypeDefaultDescription
--bodystring-Response body
--control-urlstringhttp://localhost:8081Control API URL
--delayint0Response delay in ms
--header-conditionsstring-Request header conditions as JSON or k=v,k2=v2
--headersstring-Response headers as JSON or k=v,k2=v2
--matchstringexactMatch type: exact, wildcard, or regex
--methodstring-HTTP method filter
--namestring-Rule name
--priorityint0Rule priority (lower values match first)
--statusint200Response status code
--urlstring-URL pattern

apxy mock list

List all configured mock response rules.

apxy mock list [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--formatstringjsonOutput format: json or toon
-q, --quiet-falseOutput only IDs, one per line

apxy mock remove

Remove a mock response rule by its unique ID, or remove all mock rules with --all.

apxy mock remove [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Rule ID

apxy mock enable

Re-enable a previously disabled mock rule by its unique ID, or enable all mock rules with --all.

apxy mock enable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Rule ID

apxy mock disable

Disable a mock rule without removing it. Disabled rules are ignored during matching.

apxy mock disable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Rule ID

apxy mock clear

Delete ALL mock response rules from the running proxy.

Warning: This action cannot be undone.

apxy mock clear [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing

See Mock Rules for details.


apxy rewrite

Create and manage request URL rewrite rules for the running proxy.

apxy rewrite set

Add a redirect rule that rewrites the URL of matching requests before forwarding.

apxy rewrite set [flags]

Examples:

apxy rewrite set --name "staging" \ --from "https://api.example.com" --to "https://staging.example.com" --match exact apxy rewrite set --name "v2-api" \ --from "https://api.example.com/v1/*" --to "https://api.example.com/v2/*" --match wildcard
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--fromstring-Source URL pattern
--matchstringexactMatch type: exact, wildcard, or regex
--namestring-Rule name
--tostring-Destination URL

apxy rewrite list

List all configured redirect rules.

apxy rewrite list [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--formatstringjsonOutput format: json or toon
-q, --quiet-falseOutput only IDs, one per line

apxy rewrite remove

Remove a redirect rule by its unique ID, or remove all redirect rules with --all.

apxy rewrite remove [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Redirect rule ID

apxy rules interceptor

Create and manage dynamic interceptors for the running proxy.

apxy rules interceptor set

Add a dynamic interceptor that can observe, modify, or mock requests and responses matching an expression.

apxy rules interceptor set [flags]

Examples:

apxy rules interceptor set --name "add-auth" \ --match "host == api.example.com" --action modify \ --add-request-headers Authorization="Bearer tok" apxy rules interceptor set --name "slow-down" \ --match "path contains /search" --action observe --delay-ms 500
FlagTypeDefaultDescription
--actionstringobserveAction: mock, modify, or observe
--add-request-headersk=v,...-Add request headers if missing
--control-urlstringhttp://localhost:8081Control API URL
--delay-msint0Delay in milliseconds before forwarding/responding
--descriptionstring-Optional description
--matchstring-Match expression (e.g. host == api.example.com)
--namestring-Interceptor name
--remove-headersstrings-Headers to remove
--set-request-headersk=v,...-Overwrite request headers
--set-response-bodystring-Override response body
--set-response-headersk=v,...-Set/overwrite response headers
--set-response-statusint-Override response status

See Dynamic Interceptors for the full DSL reference.

apxy rules interceptor list

List all configured interceptors.

apxy rules interceptor list [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--formatstringjsonOutput format: json or toon
-q, --quiet-falseOutput only IDs, one per line

apxy rules interceptor remove

Remove an interceptor by its unique ID, or remove all interceptors with --all.

apxy rules interceptor remove [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Interceptor ID

apxy breakpoint

Create and manage breakpoint rules for the running proxy. Paid feature.

apxy breakpoint add

Add a breakpoint rule that pauses matching requests or responses for manual inspection.

apxy breakpoint add [flags]

Examples:

apxy breakpoint add --name "pause-login" \ --match "path contains /login" --phase request apxy breakpoint add --name "inspect-errors" \ --match "status >= 500" --phase response --timeout 60000
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--matchstring-DSL match expression
--namestring-Breakpoint name
--phasestringbothPhase: request, response, or both
--timeoutint30000Auto-resume timeout in milliseconds

apxy breakpoint list

List all configured breakpoint rules.

apxy breakpoint list [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--formatstringjsonOutput format: json or toon
-q, --quiet-falseOutput only IDs, one per line

apxy breakpoint enable

Re-enable a previously disabled breakpoint rule.

apxy breakpoint enable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Breakpoint rule ID

apxy breakpoint disable

Disable a breakpoint rule without removing it. Disabled rules will not pause traffic.

apxy breakpoint disable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Breakpoint rule ID

apxy breakpoint remove

Remove a breakpoint rule by its unique ID, or remove all breakpoint rules with --all.

apxy breakpoint remove [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Breakpoint rule ID

apxy breakpoint pending

List all requests and responses that are currently paused at a breakpoint, waiting for resolution.

apxy breakpoint pending [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
-q, --quiet-falseOutput only IDs, one per line

apxy breakpoint resolve

Resume a request or response that is currently paused at a breakpoint, optionally modifying it.

apxy breakpoint resolve [flags]

Examples:

apxy breakpoint resolve --id abc123 apxy breakpoint resolve --id abc123 --status 200 \ --body '{"ok":true}' --headers "Content-Type=application/json"
FlagTypeDefaultDescription
--bodystring-Override body
--control-urlstringhttp://localhost:8081Control API URL
--drop-falseDrop request/response instead of forwarding
--dry-run-falsePreview without executing
--headersstring-Override headers as k=v,k2=v2
--idstring-Pending breakpoint ID
--statusint-Override status code

See Breakpoints for details.


apxy caching

Control cache behavior for proxied traffic.

apxy caching disable-cache

Disable upstream caching by stripping cache headers from proxied requests.

apxy caching disable-cache [flags]

Examples:

apxy caching disable-cache --host "api.example.com"
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--hoststring-Only disable caching for this host (empty = all)

apxy caching enable-cache

Re-enable normal upstream caching behavior, undoing a previous disable-cache command.

apxy caching enable-cache [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL

See Caching Control for details.


apxy network

Simulate network conditions on the running proxy.

apxy network set

Apply simulated network conditions to all proxied traffic for testing under degraded networks.

apxy network set [flags]

Examples:

apxy network set --latency 200 apxy network set --latency 500 --bandwidth 256 --packet-loss 5
FlagTypeDefaultDescription
--bandwidthint0Bandwidth limit in kbps (0 = unlimited)
--control-urlstringhttp://localhost:8081Control API URL
--latencyint0Artificial latency in ms
--packet-lossint0Packet loss percentage (0–100)

apxy network clear

Remove all simulated network conditions, restoring normal proxy throughput.

apxy network clear [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing

See Network Conditions for details.


apxy script

Create and manage proxy scripts for the running proxy. Paid feature.

apxy script add

Add a JavaScript proxy script that runs on matching requests or responses. Provide the script via --file (path to a .js file) or --code (inline JavaScript).

apxy script add [flags]

Examples:

apxy script add --name "log-headers" \ --file ./scripts/log-headers.js --hook onRequest apxy script add --name "rewrite-body" \ --code 'response.body = response.body.replace("foo","bar")' \ --match "host == api.example.com"
FlagTypeDefaultDescription
--codestring-Inline JavaScript code
--control-urlstringhttp://localhost:8081Control API URL
--filestring-Path to JavaScript file
--hookstringonResponseHook: onRequest or onResponse
--matchstring*DSL match expression
--namestring-Script name

apxy script list

List all configured proxy scripts.

apxy script list [flags]
FlagTypeDefaultDescription
--control-urlstringhttp://localhost:8081Control API URL
--formatstringjsonOutput format: json or toon
-q, --quiet-falseOutput only IDs, one per line

apxy script enable

Re-enable a previously disabled proxy script.

apxy script enable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Script ID

apxy script disable

Disable a proxy script without removing it. Disabled scripts are skipped during execution.

apxy script disable [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Script ID

apxy script remove

Remove a proxy script by its unique ID, or remove all scripts with --all.

apxy script remove [flags]
FlagTypeDefaultDescription
--all-falseApply to all resources
--control-urlstringhttp://localhost:8081Control API URL
--dry-run-falsePreview without executing
--idstring-Script ID

See JavaScript Scripting for details.


Inherited Options

FlagTypeDefaultDescription
--configstring./configs/default.yamlConfig file path
--error-formatstringtextError output format: text or json
--help-formatstringdefaultHelp output format: default or agent
--verbose-falseEnable verbose output
Last updated on