Proxy, Record & Replay
SureStage can act as a proxy to real APIs, recording traffic for later replay in isolated test environments. This is one of the most powerful features for creating realistic mock environments.
Overview
The proxy feature supports four operating modes:
| Mode | Behavior |
|---|---|
| Proxy | Forward all requests to the target API transparently |
| Record | Forward requests to the target AND save request/response pairs |
| Replay | Return previously recorded responses without hitting the target |
| Hybrid | Use recorded responses when available, proxy to target otherwise |
Setting Up a Proxy
- Open a simulation and go to Proxy Settings
- Configure the proxy:
- Target URL - The real API base URL (e.g.,
https://api.stripe.com) - Mode - Select the operating mode
- Authentication forwarding - Pass through auth headers to the target
- Target URL - The real API base URL (e.g.,
Recording Filters
Control what gets recorded:
- Include/exclude paths - Only record specific endpoints
- Method filter - Record only GET, POST, etc.
- Status filter - Only record successful responses (2xx)
- Header filter - Exclude requests with specific headers
Recording Sessions
Starting a Session
- Set the proxy mode to Record
- Click Start Recording
- Send traffic through the proxy (or let your application do it)
- Click Stop Recording when done
Reviewing Recorded Pairs
After recording, review captured request/response pairs:
- View request method, path, headers, and body
- View response status, headers, and body
- Approve pairs to include in replay
- Reject pairs to exclude
- Edit responses before saving
Sanitization Rules
Automatically clean recorded data before replay:
- Redact headers - Remove auth tokens, API keys
- Mask fields - Replace sensitive body fields with placeholders
- Normalize timestamps - Make recorded responses time-independent
- Remove cookies - Strip session cookies
Example sanitization rules:
Header "Authorization" -> Replace with "Bearer {{mock_token}}"
Body field "$.card.number" -> Replace with "4242424242424242"
Body field "$.timestamp" -> Replace with "{{$isoTimestamp}}"
Replay Configuration
Matching Strategy
When replaying, SureStage matches incoming requests to recorded pairs using:
- Exact match - Method + path + query + body must match exactly
- Relaxed match - Method + path match, ignore query params and body
- Custom rules - Define your own matching criteria
Mode Switching
Switch between modes at any time:
- Start in Proxy mode for normal development
- Switch to Record to capture a session
- Switch to Replay for offline testing
- Use Hybrid for mixed scenarios
Converting to Permanent Routes
Promote recorded pairs to permanent mock routes:
- Select approved recorded pairs
- Click Convert to Routes
- Routes are created in the simulation with the recorded responses
- Edit as needed (add dynamic variables, multiple responses, etc.)
Exporting Sessions
Export recorded sessions as:
- HAR file - Standard HTTP archive format
- Postman Collection - For use in Postman
- OpenAPI Spec - Auto-generated from recorded endpoints
Typical Workflow
Next Steps
- AI Features - Enhance recorded responses with AI-generated variations
- Flows - Build automated test sequences using recorded data
- Troubleshooting: Proxy - Fix recording issues