Skip to content

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:

  1. In the NectoProxy Web UI, locate the HAR Export/Import controls in the header toolbar.
  2. Click the Export button (download icon).
  3. Select the session you want to export.
  4. A .har file 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:

bash
# Export a session by session ID
curl http://localhost:8889/api/har/export/<session-id> \
  -o traffic-export.har

Export Selected Entries

If you only need a subset of the captured traffic:

  1. In the traffic list, select the entries you want to export. You can select multiple entries.
  2. Use the export option to export only the selected entries.

Via the API:

bash
# 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.har

TIP

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.

  1. In the NectoProxy Web UI, click the Import button (upload icon) in the header toolbar.
  2. Select the .har file from your file system.
  3. NectoProxy creates a new session named "Imported: [filename]" and populates it with the traffic entries from the HAR file.

Via the API:

bash
# 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:

bash
curl -X POST http://localhost:8889/api/har/validate \
  -F "file=@traffic-data.har"

Response:

json
{
  "valid": true,
  "version": "1.2",
  "creator": {
    "name": "Google Chrome",
    "version": "120.0"
  },
  "entryCount": 47
}

Sharing HAR Files with Your Team

Common Sharing Scenarios

  1. Bug reports: Export the traffic that reproduces the bug and attach the HAR file to your issue tracker.
  2. API documentation: Share a HAR file showing the sequence of API calls for a specific workflow.
  3. Performance analysis: Export a session and share it with the performance team for review.
  4. 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:

ToolExport Location
Chrome DevToolsNetwork tab > right-click > Save all as HAR
Firefox DevToolsNetwork tab > gear icon > Save All as HAR
SafariNetwork tab > Export
Charles ProxyFile > Export Session > HTTP Archive (.har)
FiddlerFile > Export Sessions > HTTPArchive
How to export from Chrome DevTools
  1. Open Chrome DevTools (F12 or Cmd+Option+I).
  2. Go to the Network tab.
  3. Reproduce the action you want to capture.
  4. Right-click anywhere in the request list.
  5. Select Save all as HAR with content.
  6. 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:

  1. Open the .har file in a text editor.
  2. Search for sensitive header names like Authorization, Cookie, Set-Cookie, X-API-Key.
  3. Replace their values with [REDACTED].
  4. Search for sensitive data in request/response bodies.
  5. Save the file.

You can also automate this with a script:

bash
# 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.har

Tips

  • 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.