Describe what you want to do with your HTTP traffic, and get a validated
Fluxzy rule file back. The generated YAML is checked against
Fluxzy's own rule parser before being returned, so a successful result always loads in
Fluxzy Desktop, the CLI (fluxzy start -r rule.fxzy.yaml), and .NET.
A rule pairs a filter (which traffic to target) with one or more actions (what to do with it): mock API responses, rewrite headers, redirect hosts, throttle bandwidth, inject delays and more. Browse the full directive library. Each answer below shows the plain-language description and the generated, ready-to-use YAML rule file.
Return a canned JSON body for one endpoint while everything else passes through: test error handling or develop against an API that does not exist yet.
Describe it as: "Mock a 200 JSON response {"status": "ok"} for any request to api.example.com/health, without contacting the server"
rules:
- filter:
typeKind: FilterCollection
children:
- typeKind: HostFilter
pattern: api.example.com
operation: Exact
- typeKind: PathFilter
pattern: /health
operation: Exact
operation: And
action:
typeKind: MockedResponseAction
response:
statusCode: 200
headers: []
body:
origin: FromString
type: Json
text: '{"status": "ok"}'
actions: []
Try this example
Point a mobile app or third-party client at the code running on your machine without rebuilding it or editing hosts files.
Describe it as: "Redirect all traffic going to api.example.com to my local dev server on localhost port 3000"
rules:
- filter:
typeKind: HostFilter
pattern: api.example.com
operation: Exact
action:
typeKind: ForwardAction
url: http://localhost:3000
actions: []
Try this example
Add latency to a single dependency to see how your app behaves when a CDN or API slows down, while the rest of the traffic stays fast.
Describe it as: "Simulate a slow network by delaying every response from cdn.example.com by 3 seconds"
rules:
- filter:
typeKind: HostFilter
pattern: cdn.example.com
operation: Exact
action:
typeKind: DelayAction
duration: 3000
scope: ResponseHeaderReceivedFromRemote
actions: []
Try this example
Add Access-Control-Allow-Origin and related CORS headers to any API's responses on the fly, with no server change and no separate CORS proxy, so your local frontend can call it directly.
Describe it as: "Add the response header Access-Control-Allow-Origin: * to every response coming from api.example.com"
rules:
- filter:
typeKind: HostFilter
pattern: api.example.com
operation: Exact
action:
typeKind: AddResponseHeaderAction
headerName: Access-Control-Allow-Origin
headerValue: '*'
actions: []
Try this example
Force one endpoint to return a server error with a JSON body while the rest of the traffic passes through: verify retries, fallbacks and error messages without breaking the real backend.
Describe it as: "Return a 500 Internal Server Error with a JSON body {"error": "internal"} for every request to api.example.com/orders, so I can test my app's error handling"
rules:
- filter:
typeKind: FilterCollection
children:
- typeKind: HostFilter
pattern: api.example.com
operation: Exact
- typeKind: PathFilter
pattern: /orders
operation: Exact
operation: And
action:
typeKind: MockedResponseAction
response:
statusCode: 500
headers:
- name: Content-Type
value: application/json
body:
origin: FromString
type: Text
text: '{"error": "internal"}'
actions: []
Try this example
Rule files work everywhere Fluxzy runs, with no proxy scripting required: import them
into Fluxzy Desktop (menu Settings,
Manage rules, Import, paste the rule in the dialog,
then Import and Save), load them in the CLI with
fluxzy start -r rule.fxzy.yaml, or use them from .NET.