Skip to content

Latest commit

 

History

History
130 lines (86 loc) · 5.67 KB

automatic-setup.md

File metadata and controls

130 lines (86 loc) · 5.67 KB
description Use Proxyman Automatic Setup to open a pre-configured Terminal and capture HTTP/HTTPS traffic from NodeJS, Python, Ruby, Golang and cURL in one click.

Automatic Setup

1. Problems

Proxyman could not capture HTTP/HTTPS traffic from the following setup:

  • NodeJS: Axios, got, superagent, fetch, and node-fetch
  • Python: http, https, aiohttp, requests
  • Ruby: http, net/http, net/https, faraday, httparty, and fastlane
  • Golang: net/http, fasthttp, resty, gorequest, req, grequests
  • ElectronJS
  • cURL

It's a known issue: NodeJS, Python, Ruby, and cURL run from the Terminal app don't use the system HTTP proxy. So there is no traffic in Proxyman.

You have to read the technical documentation of each library and manually configure:

  • The HTTP Proxy
  • Trust for a self-signed certificate

=> Time-consuming and error-prone ❌

2. Solution: Automatic Setup

Benefit:

  • ✅ 1-click to automatically set up HTTP Proxy & Certificate on a variety of dev environments
  • Capture HTTP(s) traffic from NodeJS, Python, Ruby, Golang, Terminal or Web Browser, etc.
  • Safe. It works in your current session and doesn't affect your OS

How to use:

  1. Open Proxyman -> Setup menu -> Automatic Setup…
  2. Click Open New Terminal…. You can pick Apple Terminal, iTerm2, or Ghostty from the menu next to it.
  3. Accept the AppleScript permission prompt if needed
  4. The new Terminal window opens -> Start your backend server or run your scripts => Proxyman automatically captures all traffic.
  5. Done ✅

Proxyman Automatic Setup window with Apple Terminal and Open New Terminal, plus Web Browsers and ElectronJS App sections

Start the pre-configured Terminal app

Terminal window showing the Proxyman Automatic Setup scripts message, ready to start a backend server

New Terminal app is launched

Notes:

  • Automatic Setup can open Apple Terminal, iTerm2, or Ghostty. To use another Terminal app (for example Hyper), select My own Terminal… in the same menu or use the Manual Setup.
  • It's safe because it only runs in your current session. It doesn't change your system configuration.

ElectronJS

  1. Open a new Terminal from Automatic Setup
  2. Use this command line:
open ~/Applications/your_electron_app.app

You can also click Select ElectronJS App… in the Automatic Setup window. See ElectronJS.

Support Libraries:

Proxyman (with Automatic Setup) works out of the box with the following network libraries.

{% hint style="success" %} It's completely SAFE since the change only affects your current Terminal session. It doesn't change your bash_profile or zshrc file. {% endhint %}

3. Advanced: How does it work?

When you click Open New Terminal…, Proxyman does the following:

  1. Uses AppleScript to start the Terminal app.
  2. Runs this command line in the new Terminal window:
set -a && source "$HOME/.proxyman/proxyman_env_automatic_setup.sh" && set +a
  1. proxyman_env_automatic_setup.sh is a bash script that sets the environment variables Proxyman needs.

For example:

  • HTTP_PROXY & HTTPS_PROXY env
  • PATH
  • RUBYLIB
  • PYTHONPATH
  • NODE_OPTIONS
  • GLOBAL_AGENT_HTTP_PROXY

NodeJS:

  1. Proxyman prepends a new Node directory to the $PATH env.
  2. Proxyman monkey-patches Node with the global-agent package, which adds HTTP proxy support to axios and fetch.

Ruby:

  1. Overrides $RUBYLIB to point to the Proxyman app
  2. Patches common libraries, such as http, net/http and net/https -> Sets the HTTP proxy and trusts the Proxyman self-signed certificate.

Python:

  1. Overrides $PYTHONPATH to point to the Proxyman app
  2. Patches common libraries, such as aiohttp, httplib, http.client -> Sets the HTTP proxy and trusts the Proxyman self-signed certificate.

Go:

  1. Overrides HTTP_PROXY & HTTPS_PROXY env
  2. Overrides some Go env to trust the self-signed certificate

4. Troubleshooting

See the Troubleshooting page.

Learn more