Exporting & Importing Traffic
Difficulty: Beginner | Time: 5 minutes
This tutorial covers how to export captured traffic from NectoProxy as HAR (HTTP Archive) files, import HAR files from other tools, and share traffic data with your team.
What Is a HAR File?
HAR (HTTP Archive) is a JSON-based format for recording HTTP transactions. It is an industry standard supported by all major browsers and proxy tools. A HAR file contains:
- Every HTTP request (method, URL, headers, body)
- Every HTTP response (status, headers, body)
- Timing information
- Cookie data
- Header sizes
HAR files use the .har extension and can be viewed with browser DevTools, HAR Viewer, or imported back into NectoProxy.
Exporting Traffic
Export a Full Session
To export all traffic from a session:
- In the NectoProxy Web UI, locate the HAR Export/Import controls in the header toolbar.
- Click the Export button (download icon).
- Select the session you want to export.
- A
.harfile is downloaded to your browser's default download directory.
The exported file is named using the session name and a timestamp, e.g., Session_Jan_15_2025_1706900000.har.
Via the API:
# Export a session by session ID
curl http://localhost:8889/api/har/export/<session-id> \
-o traffic-export.harExport Selected Entries
If you only need a subset of the captured traffic:
- In the traffic list, select the entries you want to export. You can select multiple entries.
- Use the export option to export only the selected entries.
Via the API:
# Export specific entries by their IDs
curl -X POST http://localhost:8889/api/har/export \
-H "Content-Type: application/json" \
-d '{
"entryIds": ["entry-id-1", "entry-id-2", "entry-id-3"],
"sessionName": "Bug Investigation"
}' \
-o selected-traffic.harTIP
Exporting selected entries is useful when you want to share a specific bug reproduction or a particular sequence of API calls without including unrelated traffic.
Importing Traffic
Import a HAR File
You can import HAR files from any tool that produces them: Chrome DevTools, Firefox Network Monitor, Charles Proxy, Fiddler, or another NectoProxy instance.
- In the NectoProxy Web UI, click the Import button (upload icon) in the header toolbar.
- Select the
.harfile from your file system. - NectoProxy creates a new session named "Imported: [filename]" and populates it with the traffic entries from the HAR file.
Via the API:
# Import a HAR file
curl -X POST http://localhost:8889/api/har/import \
-F "file=@traffic-export.har"
# Import into a specific existing session
curl -X POST http://localhost:8889/api/har/import \
-F "file=@traffic-export.har" \
-F "sessionId=existing-session-id"
# Import with a custom session name
curl -X POST http://localhost:8889/api/har/import \
-F "file=@traffic-export.har" \
-F "sessionName=Customer Bug Report"Validate Before Importing
You can validate a HAR file before importing it to check its structure:
curl -X POST http://localhost:8889/api/har/validate \
-F "file=@traffic-data.har"Response:
{
"valid": true,
"version": "1.2",
"creator": {
"name": "Google Chrome",
"version": "120.0"
},
"entryCount": 47
}Sharing HAR Files with Your Team
Common Sharing Scenarios
- Bug reports: Export the traffic that reproduces the bug and attach the HAR file to your issue tracker.
- API documentation: Share a HAR file showing the sequence of API calls for a specific workflow.
- Performance analysis: Export a session and share it with the performance team for review.
- Support requests: Export traffic and send it to a vendor's support team to demonstrate an integration issue.
Working with HAR Files from Other Tools
NectoProxy can import HAR files generated by:
| Tool | Export Location |
|---|---|
| Chrome DevTools | Network tab > right-click > Save all as HAR |
| Firefox DevTools | Network tab > gear icon > Save All as HAR |
| Safari | Network tab > Export |
| Charles Proxy | File > Export Session > HTTP Archive (.har) |
| Fiddler | File > Export Sessions > HTTPArchive |
How to export from Chrome DevTools
- Open Chrome DevTools (F12 or Cmd+Option+I).
- Go to the Network tab.
- Reproduce the action you want to capture.
- Right-click anywhere in the request list.
- Select Save all as HAR with content.
- Import the saved file into NectoProxy.
Privacy Considerations
DANGER
HAR files may contain sensitive data! Before sharing a HAR file, review it for:
- Authentication tokens (Authorization headers, Bearer tokens, API keys)
- Session cookies (session IDs, CSRF tokens)
- Personal data (user profiles, email addresses, phone numbers)
- Passwords (especially in POST request bodies for login forms)
- Internal URLs (revealing your infrastructure)
Always sanitize HAR files before sharing them outside your team.
Sanitizing HAR Files
Since HAR files are JSON, you can edit them in any text editor to remove sensitive data:
- Open the
.harfile in a text editor. - Search for sensitive header names like
Authorization,Cookie,Set-Cookie,X-API-Key. - Replace their values with
[REDACTED]. - Search for sensitive data in request/response bodies.
- Save the file.
You can also automate this with a script:
# Simple example using jq to redact Authorization headers
cat traffic.har | jq '
.log.entries[].request.headers |= map(
if .name == "Authorization" then .value = "[REDACTED]"
elif .name == "Cookie" then .value = "[REDACTED]"
else . end
)
' > sanitized-traffic.harTips
- Keep exports focused. Export only the relevant session or entries instead of everything. Smaller HAR files are easier to share and faster to import.
- Use session names. Name your sessions descriptively (e.g., "Login Flow Bug #1234") so the exported HAR file name is meaningful.
- Check file size. HAR files with response bodies can be large. If you are sharing via email or chat, consider compressing the file first:
gzip traffic.har. - Import creates a new session. Imported traffic appears in its own session, keeping it separate from your live captured traffic.