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:

  1. Navigate to your project in the dashboard at https://app.edgewrap.pro.
  2. Go to the Data & Privacy page and select the Shadow Traffic tab.
  3. Toggle the Shadow Traffic switch to Enabled.
  4. Enter the Shadow Origin URL (the address of your staging/mirror test server).
  5. Specify the Traffic Percent (percentage of requests to clone, from 1 to 100).
  6. Enter any Exclude Path Patterns (e.g. bypass mirroring for sensitive routes like `/api/checkout`).
  7. Click Save Settings.

API Configuration

Alternatively, you can manage Shadow Traffic programmatically:

ParamTypeDescription
isEnabledbooleanEnable or disable traffic shadowing.
shadowOriginUrlstringStaging/mirror destination URL.
trafficPercentnumberPercentage of production requests to mirror (1 to 100).(default: 10)
excludePathPatternsstring[]Array of glob paths that should bypass shadowing.
Configure traffic shadowing via API
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/*"]
  }'
Warning: Since mirrored requests replicate actual operations (including database insertions or third-party webhooks), ensure your shadow origin points to isolated test databases and sandbox services.