Ruby

1. Set HTTP Proxy to Ruby

Net::HTTP will automatically create a proxy from the http_proxy environment 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.

Ref: https://stackoverflow.com/questions/15792999/how-to-set-a-proxy-in-rubys-net-http‚Äč

2. Install Proxyman Certificate on Ruby

By default, Ruby on macOS might not trust Proxyman 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 SSL_CERT_FILE env.

$ env SSL_CERT_FILE=~/.proxyman/proxyman-ca.pem ruby my_script.rb