Building frontend applications often means waiting for backend APIs that don't exist yet. Or testing against third-party APIs with rate limits. Or debugging issues that only happen in production.
What if you could record real API traffic and instantly spin up a mock server that behaves exactly the same way? That's what ProxyKit's HAR-to-Mock feature does.
Why Mock APIs from HAR Files?
HAR (HTTP Archive) files capture real API traffic, including:
- Request URLs, methods, and headers
- Request bodies (POST/PUT/PATCH data)
- Response status codes
- Response headers and bodies
This makes HAR files the perfect source for mock servers because the responses are real data from real APIs. No guessing, no manual mocking, no keeping mock data in sync with production.
Use Cases
HAR-based mock servers solve real problems:
- Frontend development without backend: Start building the UI before the API is ready. Record traffic from a prototype or similar API.
- Offline development: Work on planes, trains, or anywhere without internet. Your mock server runs locally.
- Testing against rate-limited APIs: Stripe, Twilio, and other APIs have rate limits. Mock them for unlimited local testing.
- Reproducing production bugs: Capture the exact API responses that caused a bug, then replay them locally for debugging.
- Demo environments: Create consistent demo data that won't change during customer presentations.
How It Works
ProxyKit's mock server generator works in three steps:
-
Capture a HAR file
Use browser DevTools, Charles Proxy, or any HTTP capture tool to record API traffic as a HAR file.
-
Upload to ProxyKit
Visit the HAR Viewer and upload your HAR file. ProxyKit parses all requests and responses.
-
Generate your mock server
Click "Generate Mock Server" and get a unique URL. Every endpoint from your HAR file is now available as a working API.
Step-by-Step: Creating Your First Mock Server
1. Capture the HAR File
Open Chrome DevTools (F12 or Cmd+Option+I), go to the Network tab, and perform the API operations you want to mock. Then:
- Right-click anywhere in the request list
- Select "Save all as HAR with content"
- Save the file
Filter your network requests to show only XHR/Fetch before saving. This excludes images, fonts, and other static assets you don't need to mock.
2. Upload and Review
Go to ProxyKit's HAR Viewer and drag your HAR file onto the page. You'll see all captured endpoints organized by domain.
Review the endpoints to make sure they include the APIs you want to mock. Use the filters to narrow down by HTTP method or status code.
3. Generate the Mock Server
Click the "Generate Mock Server" button. ProxyKit will:
- Deduplicate endpoints (same method + path = one mock route)
- Create a unique URL for your mock server
- Return the mock server URL and a list of available routes
4. Use Your Mock Server
Replace your API base URL with the mock server URL. For example, if your real API was:
https://api.example.com/v1/users
And your mock server is:
https://proxykit-7xjg.polsia.app/mock/a1b2c3d4
Then call:
https://proxykit-7xjg.polsia.app/mock/a1b2c3d4/v1/users
The mock server responds with the exact same data from your HAR file.
What Gets Mocked
Each mock endpoint preserves:
| Attribute | Preserved? |
|---|---|
| HTTP Method (GET, POST, etc.) | Yes |
| URL Path | Yes |
| Response Status Code | Yes |
| Response Headers | Yes (most) |
| Response Body | Yes |
| Query Parameters | Stored, not matched |
Mock routes match by HTTP method and path only. Query parameters in the HAR are stored but requests with different query params will still match the same route.
Mock Server Features
CORS Enabled
All mock endpoints include CORS headers, so you can call them from any origin. No proxy configuration needed.
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: *
Automatic Deduplication
If your HAR file contains multiple requests to the same endpoint (same method + path), ProxyKit uses the first one. This keeps your mock server clean.
7-Day Expiration
Mock servers expire after 7 days to keep things clean. Need a longer-lived mock? Export to OpenAPI and use a dedicated mock service.
Viewing Available Routes
After generating a mock server, you can view all available routes by visiting:
https://proxykit-7xjg.polsia.app/mock/{your-slug}
This returns a JSON object listing every route, its HTTP method, and status code.
When to Use Mock Servers vs OpenAPI
ProxyKit can export to both mock servers and OpenAPI specs. Here's when to use each:
| Use Case | Mock Server | OpenAPI |
|---|---|---|
| Quick frontend testing | Best | - |
| Demos and presentations | Best | - |
| API documentation | - | Best |
| Code generation | - | Best |
| CI/CD integration | Good | Best |
Limitations
HAR-based mock servers work great for static responses. They don't support:
- Dynamic responses: Every request to the same endpoint returns the same response
- Request validation: The mock server doesn't validate request bodies
- Stateful operations: POST doesn't actually create data, DELETE doesn't remove it
For dynamic mocking with request validation and stateful behavior, export to OpenAPI and use a tool like Prism or Mockoon.
Conclusion
HAR-to-Mock is the fastest way to create realistic mock APIs. No code, no configuration, just real responses from real traffic.
Next time you're waiting for a backend API, blocked by rate limits, or debugging a production issue, capture a HAR file and spin up a mock server in seconds.
Ready to Create Your Mock Server?
Upload a HAR file and generate a working mock API in under 60 seconds.
Open HAR Viewer