Skip to main content

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:

ModeBehavior
ProxyForward all requests to the target API transparently
RecordForward requests to the target AND save request/response pairs
ReplayReturn previously recorded responses without hitting the target
HybridUse recorded responses when available, proxy to target otherwise

Setting Up a Proxy

  1. Open a simulation and go to Proxy Settings
  2. 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

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

  1. Set the proxy mode to Record
  2. Click Start Recording
  3. Send traffic through the proxy (or let your application do it)
  4. 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:

  1. Start in Proxy mode for normal development
  2. Switch to Record to capture a session
  3. Switch to Replay for offline testing
  4. Use Hybrid for mixed scenarios

Converting to Permanent Routes

Promote recorded pairs to permanent mock routes:

  1. Select approved recorded pairs
  2. Click Convert to Routes
  3. Routes are created in the simulation with the recorded responses
  4. 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