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
Setup Process
Configure proxy mode for your mock API
Configuration Steps
Navigate to API Settings
Go to your API overview and click "Show Settings"
Enable Proxy Mode
Toggle "Enable proxy mode" in the Proxy Mode section
Set Target URL
Enter your backend URL (auto-filled from OpenAPI servers if available)
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:
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
→ PUT /users/me/profile
→ GET /users/me/preferences
→ Scenario 2: Testing Edge Cases
Test error conditions and edge cases while using real data for context:
GET /orders
→ POST /orders
→ GET /orders/123/status
→ 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
- • If proxy requests fail, check that your target URL is accessible from the internet
- • Ensure your backend accepts the forwarded headers (X-Forwarded-*)
- • Check your backend's CORS settings if making browser requests
- • Proxy requests have a 30-second timeout