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| Flag | Type | Default | Description |
|---|---|---|---|
--body | string | - | Response body |
--control-url | string | http://localhost:8081 | Control API URL |
--delay | int | 0 | Response delay in ms |
--header-conditions | string | - | Request header conditions as JSON or k=v,k2=v2 |
--headers | string | - | Response headers as JSON or k=v,k2=v2 |
--match | string | exact | Match type: exact, wildcard, or regex |
--method | string | - | HTTP method filter |
--name | string | - | Rule name |
--priority | int | 0 | Rule priority (lower values match first) |
--status | int | 200 | Response status code |
--url | string | - | URL pattern |
apxy mock list
List all configured mock response rules.
apxy mock list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--format | string | json | Output format: json or toon |
-q, --quiet | - | false | Output 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]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | 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]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Rule ID |
apxy mock disable
Disable a mock rule without removing it. Disabled rules are ignored during matching.
apxy mock disable [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Rule ID |
apxy mock clear
Delete ALL mock response rules from the running proxy.
Warning: This action cannot be undone.
apxy mock clear [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview 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| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--from | string | - | Source URL pattern |
--match | string | exact | Match type: exact, wildcard, or regex |
--name | string | - | Rule name |
--to | string | - | Destination URL |
apxy rewrite list
List all configured redirect rules.
apxy rewrite list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--format | string | json | Output format: json or toon |
-q, --quiet | - | false | Output 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]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | 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| Flag | Type | Default | Description |
|---|---|---|---|
--action | string | observe | Action: mock, modify, or observe |
--add-request-headers | k=v,... | - | Add request headers if missing |
--control-url | string | http://localhost:8081 | Control API URL |
--delay-ms | int | 0 | Delay in milliseconds before forwarding/responding |
--description | string | - | Optional description |
--match | string | - | Match expression (e.g. host == api.example.com) |
--name | string | - | Interceptor name |
--remove-headers | strings | - | Headers to remove |
--set-request-headers | k=v,... | - | Overwrite request headers |
--set-response-body | string | - | Override response body |
--set-response-headers | k=v,... | - | Set/overwrite response headers |
--set-response-status | int | - | Override response status |
See Dynamic Interceptors for the full DSL reference.
apxy rules interceptor list
List all configured interceptors.
apxy rules interceptor list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--format | string | json | Output format: json or toon |
-q, --quiet | - | false | Output 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]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | 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| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--match | string | - | DSL match expression |
--name | string | - | Breakpoint name |
--phase | string | both | Phase: request, response, or both |
--timeout | int | 30000 | Auto-resume timeout in milliseconds |
apxy breakpoint list
List all configured breakpoint rules.
apxy breakpoint list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--format | string | json | Output format: json or toon |
-q, --quiet | - | false | Output only IDs, one per line |
apxy breakpoint enable
Re-enable a previously disabled breakpoint rule.
apxy breakpoint enable [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Breakpoint rule ID |
apxy breakpoint disable
Disable a breakpoint rule without removing it. Disabled rules will not pause traffic.
apxy breakpoint disable [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | 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]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | 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]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
-q, --quiet | - | false | Output 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"| Flag | Type | Default | Description |
|---|---|---|---|
--body | string | - | Override body |
--control-url | string | http://localhost:8081 | Control API URL |
--drop | - | false | Drop request/response instead of forwarding |
--dry-run | - | false | Preview without executing |
--headers | string | - | Override headers as k=v,k2=v2 |
--id | string | - | Pending breakpoint ID |
--status | int | - | 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"| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--host | string | - | 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]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control 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| Flag | Type | Default | Description |
|---|---|---|---|
--bandwidth | int | 0 | Bandwidth limit in kbps (0 = unlimited) |
--control-url | string | http://localhost:8081 | Control API URL |
--latency | int | 0 | Artificial latency in ms |
--packet-loss | int | 0 | Packet loss percentage (0–100) |
apxy network clear
Remove all simulated network conditions, restoring normal proxy throughput.
apxy network clear [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview 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"| Flag | Type | Default | Description |
|---|---|---|---|
--code | string | - | Inline JavaScript code |
--control-url | string | http://localhost:8081 | Control API URL |
--file | string | - | Path to JavaScript file |
--hook | string | onResponse | Hook: onRequest or onResponse |
--match | string | * | DSL match expression |
--name | string | - | Script name |
apxy script list
List all configured proxy scripts.
apxy script list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--control-url | string | http://localhost:8081 | Control API URL |
--format | string | json | Output format: json or toon |
-q, --quiet | - | false | Output only IDs, one per line |
apxy script enable
Re-enable a previously disabled proxy script.
apxy script enable [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Script ID |
apxy script disable
Disable a proxy script without removing it. Disabled scripts are skipped during execution.
apxy script disable [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Script ID |
apxy script remove
Remove a proxy script by its unique ID, or remove all scripts with --all.
apxy script remove [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--all | - | false | Apply to all resources |
--control-url | string | http://localhost:8081 | Control API URL |
--dry-run | - | false | Preview without executing |
--id | string | - | Script ID |
See JavaScript Scripting for details.
Inherited Options
| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | ./configs/default.yaml | Config file path |
--error-format | string | text | Error output format: text or json |
--help-format | string | default | Help output format: default or agent |
--verbose | - | false | Enable verbose output |