Capture HTTP/HTTPS Traffic from Ruby with Proxyman
Proxyman v4.7.0 or later can capture HTTP/HTTPS traffic from Ruby with 1-click.
- 1-click solution: No need to manually set HTTP Proxy config or trust the self-signed certificate.
- Support many Ruby libraries: http, net/http, net/https, httparty, and faraday.
- 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 Ruby Backend Server, or Run scripts => Proxyman automatically captures all traffic.
- 5.Done ✅
Capture Traffic from Ruby
Net::HTTP will automatically create a proxy from the
http_proxyenvironment variable if it is present.
So you can use:
ENV['http_proxy'] = 'http://127.0.0.1:9090' # your http://address:port here
and Net::HTTP will use it for all requests by default.
By default, Ruby on macOS might not trust Proxyman's self-signed certificate. As a result, you might encounter SSL Error if you try to intercept HTTPS traffic.
You can explicitly tell Ruby to use Proxyman Certificate by using
$ env SSL_CERT_FILE=~/.proxyman/proxyman-ca.pem ruby my_script.rb