Shadow Traffic
Mirror a percentage of production traffic to a test or staging origin to evaluate software behavior under load without impacting users.
How Shadow Traffic Works
When launching new versions of your API or microservice, synthetic benchmarks and staging tests fail to accurately simulate real user patterns.
Shadow Traffic (also known as traffic mirroring) copies client requests at the edge. The primary request is sent to the production origin and returned to the client as usual. Simultaneously, a copy of the request (headers, path, cookies, body) is sent asynchronously to your shadow/staging origin. EdgeWrap discards the shadow origin's response, ensuring clients are never affected by bugs in the test build.
Dashboard Setup & Configuration
You can configure Shadow Traffic directly inside the EdgeWrap Dashboard:
- Navigate to your project in the dashboard at
https://app.edgewrap.pro. - Go to the Data & Privacy page and select the Shadow Traffic tab.
- Toggle the Shadow Traffic switch to Enabled.
- Enter the Shadow Origin URL (the address of your staging/mirror test server).
- Specify the Traffic Percent (percentage of requests to clone, from 1 to 100).
- Enter any Exclude Path Patterns (e.g. bypass mirroring for sensitive routes like `/api/checkout`).
- Click Save Settings.
API Configuration
Alternatively, you can manage Shadow Traffic programmatically:
| Param | Type | Description |
|---|---|---|
| isEnabled | boolean | Enable or disable traffic shadowing. |
| shadowOriginUrl | string | Staging/mirror destination URL. |
| trafficPercent | number | Percentage of production requests to mirror (1 to 100).(default: 10) |
| excludePathPatterns | string[] | Array of glob paths that should bypass shadowing. |
curl -X PATCH https://server.edgewrap.pro/v1/projects/prj_01jxyz/shadow-traffic/config \
-H "Authorization: Bearer <your_session_token>" \
-H "Content-Type: application/json" \
-d '{
"isEnabled": true,
"shadowOriginUrl": "https://staging-api.yourcompany.com",
"trafficPercent": 25,
"excludePathPatterns": ["/checkout/*", "/payment/*"]
}'