Proxyman
HomepageDownload
  • Overview
  • Changelog
  • License
  • License Manager
  • Raycast
  • Command-line
  • Security Compliance
  • Proxyman iOS
    • Proxyman for iOS
    • Map Local for iOS
    • Breakpoint for iOS
    • Tutorial for iOS
      • Map Local for iOS Tutorial
      • Breakpoint for iOS Tutorial
  • Debug on Devices
    • macOS
    • iOS Device
    • iOS Simulator
    • tvOS & watchOS
    • Android Device & Emulator
      • Automatic Script for Android Emulator
      • Sample Android Project
    • Firefox
    • Java VMs
    • Python
    • Ruby
    • NodeJS
    • Rust
    • Golang
    • React Native
    • Flutter
    • HTTP Clients
    • Docker
    • ElectronJS
    • NextJS (fetch)
  • Automatic Setup
    • Automatic Setup
    • Manual Setup
    • Troubleshooting
  • Atlantis
    • Atlantis for iOS
  • BASIC FEATURES
    • Proxyman Proxy Helper Tool
    • Request / Response Previewer
    • SSL Proxying
    • Bypass Proxy List
    • Import / Export
    • Content Filter
    • Multiple Tabs
    • Horizontal/Vertical/Window Layout
    • Copy as
    • Custom Previewer Tab
    • Custom Header Column
    • Regex (Regular Expression)
    • Filter JSON Response
    • Highlight by Color and Add Comment
    • Import / Export Settings
    • Multipart Form-Data Previewer
    • JSONPath
    • Customize Toolbar
    • Localization
    • Quick Preview
  • ADVANCED FEATURES
    • Repeat
    • Edit & Repeat
    • Compose new Request
    • No Caching
    • Breakpoint
    • Breakpoint Templates
    • Map Local (File)
    • Map Local (Directory)
    • Map Remote
    • External Proxy
    • Save Session
    • Protobuf
    • WebSocket
    • Clear Session
    • Block List
    • Allow List
    • Charles Proxy Converter
    • Custom Certificates
    • GraphQL
    • Network Conditions
    • Multiple Filters
    • Custom Filters
    • Publish to Gist
    • Reverse Proxy
    • Code Generator
    • Diff
    • Access Control
    • DNS Spoofing
    • SOCKS Proxy
    • Swagger OpenAPI
    • TLS Key Logging
  • Proxyman Windows
    • Install Certificate
    • WSL
  • Scripting
    • Scripting
    • async/await Request
    • Addons
    • Built-in JS Libraries
    • Write your own Addons
    • Snippet Code
    • Environment Variables
  • Troubleshooting
    • Proxyman does not work with VPN apps
    • My Remote Devices (iOS/Android) could not connect to Proxyman?
    • iOS 16 and iOS 17 issues
    • SSL Error from HTTPS Request/Response
    • I could not see any requests from my localhost server
    • I could not see any HTTP traffic from my NodeJS, Python, or Ruby scripts
    • *.local requests do not appear on Proxyman
    • I couldn't see any traffics on Proxyman
    • I couldn't see any requests from 3rd-party network libraries
    • [Breakpoint] Modify Request/Response by Raw Message
    • Could not change Proxyman App Icons
    • Lost data after updating Proxyman app?
    • Proxyman consumes too much RAM & unresponsive
Powered by GitBook
On this page
  • 1. New Automatic Solution (v4.7.0 or later) ✅
  • How to use:
  • 2. Old Solution (Not recommended) ❌
  • 1. Proxyman could not capture http://localhost:3000 requests to my NodeJS Server
  • Solution:
  • 2. Proxyman could not capture HTTP requests, which are called from my NodeJS local server.
  • Solution
  • 1. node-fetch
  • 2. Axios
  • 3. I use different NodeJS Library
  1. Debug on Devices

NodeJS

Capture HTTP/HTTPS traffic from NodeJS with Proxyman

PreviousRubyNextRust

Last updated 11 months ago

1. New Automatic Solution (v4.7.0 or later) ✅

Proxyman v4.7.0 or later can capture HTTP/HTTPS traffic from NodeJS with 1-click.

  • 1-click solution: No need to manually set HTTP Proxy config or trust the self-signed certificate.

  • Support many NodeJS libraries: axios, got, superagent, fetch, and node-fetch

How to use:

  1. Open Proxyman -> Setup Menu -> Automatic Setup

  2. Click on "Open New Terminal"

  3. Accept the Apple Script permission prompt if needed

  4. The New Terminal app is launched -> You can start your NodeJS Backend Server, or Run scripts => Proxyman automatically captures all traffic.

  5. For example:

$ npm start

Done ✅

Please check out the Automatic Setup page:

2. Old Solution (Not recommended) ❌

There are common problems when using NodeJS + Proxyman:

1. Proxyman could not capture http://localhost:3000 requests to my NodeJS Server

If you're using NodeJS to serve a localhost website (e.g http://localhost:3000), Proxyman might not work. For example: Use ExpressJS to serve an API Server at http://localhost:3000

Solution:

Please check out this solution.

2. Proxyman could not capture HTTP requests, which are called from my NodeJS local server.

  • Get SSL Error from HTTPS Requests

Solution

By default, all HTTP/HTTPS requests which are called from your NodeJS library don't go through HTTP Proxy Server. Thus, Proxyman could not capture the traffic.

1. node-fetch

npm install global-agent

2. At the top of your NodeJS code, add the following code:

import { bootstrap } from 'global-agent';
bootstrap();
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';

3. Add this env to your current bash. Make sure Proxyman is listening at port 9090

export GLOBAL_AGENT_HTTP_PROXY=http://127.0.0.1:9090

4. Done ✅

Run your NodeJS Script again and the HTTP/HTTPS request would appear on the Proxyman app.

Sample code

import fetch from 'node-fetch';

// Setup global-agent
import { bootstrap } from 'global-agent';
bootstrap();
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';

// fetch the data
const response = await fetch('https://httpbin.org/get?id=123');
const data = await response.json();

// Done
console.log(data);

2. Axios

According to Axios Documentation, we can simply provide the HTTP_PROXY and HTTPS_PROXY environment.

  1. Click on the Proxyman Status Menu

  2. Copy Shell Command

  1. Open the Terminal and run the paste content: For example export https_proxy=http://192.168.1.103:9090 http_proxy=http://192.168.1.103:9090

  2. On the same Terminal -> Start your NodeJS Server with axios.

  3. Axios will proxy the traffic to Proxyman.

  4. Done ✅

3. I use different NodeJS Library

If you're not using fetch or axios, the configuration might be different. Please check out your lib Document to see how to set the proxy and trust the Proxyman certificate.

I use or doesn't show on the Proxyman app

Install package

Discussion at

Automatic Setup
fetch
axios
global-agent
https://github.com/ProxymanApp/Proxyman/issues/236
Capture NodeJS Traffic