Proxy Mode

Combine mock responses with real backend calls. Route some endpoints to your actual API while mocking others for the perfect hybrid setup.

How It Works

Proxy mode intelligently routes requests based on your configuration:

Smart Routing

Unknown endpoints automatically proxy to your backend

Mock Existing

Endpoints in your OpenAPI spec continue to mock

Per-Endpoint Control

Override behavior for specific endpoints as needed

Auto-Configuration

Target URL extracted from OpenAPI server definitions

Routing Logic

Understanding how proxy mode decides where to route requests

Decision Flow

Request arrives
Check endpoint override
Has override?
Follow override setting
No override
Check OpenAPI spec
In spec
Mock response
Not in spec
Proxy to backend

Setup Process

Configure proxy mode for your mock API

Configuration Steps

1

Navigate to API Settings

Go to your API overview and click "Show Settings"

2

Enable Proxy Mode

Toggle "Enable proxy mode" in the Proxy Mode section

3

Set Target URL

Enter your backend URL (auto-filled from OpenAPI servers if available)

4

Configure Overrides

Optionally override specific endpoints to always mock or proxy

Common Use Cases

When proxy mode provides the most value

Gradual Development

Mock new endpoints while using existing backend for implemented features

Testing Scenarios

Create test scenarios with some real data and some controlled mock responses

API Migration

Gradually migrate from real API to mocks during development or testing

External Dependencies

Mock unstable endpoints while proxying stable ones to reduce flakiness

Configuration Options

Understanding the proxy mode settings

Target Backend URL

The base URL where proxy requests are forwarded. This is automatically extracted from your OpenAPI spec's servers[0].url field.

https://api.yourdomain.com/v1

Endpoint Overrides

Override the default behavior for specific endpoints:

Default
Follow smart routing logic
Mock
Always return mock response
Proxy
Always proxy to backend

Example Scenarios

Real-world examples of proxy mode in action

Scenario 1: New Feature Development

You're developing a new user profile feature while the user authentication system is already implemented:

GET /users/me
Proxy
(use real auth)
PUT /users/me/profile
Mock
(new feature)
GET /users/me/preferences
Mock
(new feature)

Scenario 2: Testing Edge Cases

Test error conditions and edge cases while using real data for context:

GET /orders
Proxy
(real order data)
POST /orders
Mock
(test validation errors)
GET /orders/123/status
Mock
(simulate various statuses)

Proxy Request Details

How requests are forwarded to your backend

Headers Added

When proxying requests, these headers are automatically added:

X-Forwarded-For: client-ip-address
X-Forwarded-Host: your-api.dotmock.com
X-Forwarded-Proto: https
User-Agent: Mockito-Proxy/1.0

Response Headers Added

Proxy responses include identification headers:

X-Proxied-By: Mockito
X-Proxy-Mode: enabled

Advanced Tips

Automatic URL extraction: Upload OpenAPI specs with server URLs for instant configuration

Fallback behavior: If proxy fails, the request falls back to mock behavior

Authentication passthrough: x-api-key headers are forwarded to your backend

Request body preservation: All request data is forwarded exactly as received