An active CleanProxies plan
Static ISP proxies for fixed US IPs, or rotating residential / mobile proxies for pools. The $4.99 trial works too.
With Net::HTTP, pass the proxy as arguments three to six: Net::HTTP.new("api.ipify.org", 443, "HOST", PORT, "USERNAME", "PASSWORD"), then set use_ssl = true. With Faraday, pass proxy: "http://USERNAME:PASSWORD@HOST:PORT" to Faraday.new.
Ruby's standard Net::HTTP and the popular Faraday gem both speak HTTP(S) proxies with Basic authentication, which is what CleanProxies uses. One detail catches people out: Net::HTTP picks up the http_proxy environment variable by default, even for HTTPS URLs, so an exported variable can route traffic you didn't mean to.
Static ISP proxies for fixed US IPs, or rotating residential / mobile proxies for pools. The $4.99 trial works too.
From the dashboard's proxy manager: host (or IP), port, username and password. Convert lists with the proxy list formatter.
gem install faraday, or add it to your Gemfile.Both products use the same setup in Ruby. What changes is how long an IP stays with you.
A Net::HTTP.start block keeps one keep-alive connection to one dedicated US ISP IP, so every request in the block, and the cookies you send with it, come from the same address. Open one connection (or one Faraday instance) per account.
Dedicated static IPs registered to US and Canadian ISPs. The address stays the same for as long as you hold it, with unlimited bandwidth and HTTP(S) or SOCKS5 access.
Each new connection through a rotating line gets a fresh residential IP, but requests inside one Net::HTTP.start block share a connection and therefore an IP. Open a new connection per request to rotate, or use a sticky line for a multi-step flow.
Residential IPs in 190+ countries with country, state and city targeting. Rotate on every request or hold a sticky session for up to 90 minutes; GB never expire.
Every product connects over HTTP(S); static ISP and ISP subnet proxies also run SOCKS5 and IP whitelisting. This is what the dashboard gives you to paste into Ruby.
IP:PORT:USER:PASSOne line per dedicated IP. With IP whitelisting on, the line is just IP:PORT and no password is sent.
HOST:PORT:USER:PASSGenerated in the proxy manager. The username carries the location and session you pick, so generate a new list to change them.
http://USERNAME:PASSWORD@HOST:PORTsocks5://USERNAME:PASSWORD@HOST:PORTUse http:// even for HTTPS websites; the TLS session still runs end to end. The socks5:// form is for static ISP and ISP subnet proxies.
Four steps, then check the exit IP with the free proxy checker.
Take host, port, username and password from a line in your CleanProxies dashboard.
Net::HTTP: positional arguments after host and port. Faraday: the proxy: option as a URL or a hash.
Set use_ssl: true in Net::HTTP. The proxy itself stays http://; the HTTPS session is tunnelled through it.
Run ruby proxy_check.rb against https://api.ipify.org and print the body.
Replace the highlighted placeholders with the values from your dashboard. Pick an example to see its code.
require "net/http"
uri = URI("https://api.ipify.org")
Net::HTTP.start(uri.host, uri.port, "HOST", PORT, "USERNAME", "PASSWORD",
use_ssl: true, open_timeout: 15, read_timeout: 30) do |http|
response = http.get(uri.request_uri)
puts response.body # the exit IP
end# export http_proxy="http://USERNAME:PASSWORD@HOST:PORT"
require "net/http"
http = Net::HTTP.new("api.ipify.org", 443) # proxy argument defaults to :ENV
http.use_ssl = true
puts http.proxy? # true when http_proxy is set
puts http.get("/").bodyNet::HTTP.new(address, port, p_addr, p_port, p_user, p_pass, p_no_proxy, p_use_ssl). Pass nil as p_addr to ignore proxy variables for a connection.require "faraday"
conn = Faraday.new(
url: "https://api.ipify.org",
proxy: "http://USERNAME:PASSWORD@HOST:PORT",
request: { open_timeout: 15, timeout: 30 }
)
puts conn.get("/", format: "json").bodyconn = Faraday.new(
url: "https://example.com",
proxy: { uri: "http://HOST:PORT", user: "USERNAME", password: "PASSWORD" }
)proxy: option, Faraday reads http_proxy and https_proxy for the request's scheme; set Faraday.ignore_env_proxy = true to stop that.Net::HTTP and Faraday's default adapter have no SOCKS client, so use the HTTP(S) form of your credentials; it works on every CleanProxies product. SOCKS5 itself exists only on static ISP and ISP subnet proxies, and in Ruby it needs a third-party gem, so HTTP(S) is the simpler choice.
The first example prints the exit IP. To see which proxy Net::HTTP picked up, check http.proxy?, http.proxy_address and http.proxy_from_env? before you send the request.
Open What is my IP? through the proxy to see the address and headers a website receives, or paste up to ten lines into the free proxy checker to test connectivity, latency and exit IP.
Still stuck? Our 24/7 support team answers fast: contact us with the error and the line you used (leave the password out).
curl -x, then check the port and firewall.http_proxy from the environment by default, also for HTTPS.Pass nil as the third argument, or unset the variable.use_ssl left off for port 443, or an https:// proxy URL pointed at an HTTP proxy port.Set use_ssl: true and keep the proxy URL http://.Setup guides and best practices from the CleanProxies blog.
Setup guides for tools people run next to Ruby.
The proxies dict, Session-level proxies, SOCKS5 with remote DNS and rotation over an ISP list.
Setup guidecurl_setopt proxy options, SOCKS5 with remote DNS, and the Guzzle and Laravel HTTP client equivalents.
Setup guidehttp.Transport with ProxyURL for HTTP(S) and SOCKS5, env vars, keep-alive rotation and goroutines over a proxy list.
Setup guideThe -x flag, separate credentials, socks5h for remote DNS, env vars and a loop to test a whole list.
Setup guideStraight answers about running CleanProxies in Ruby.
Net::HTTP.new(address, port, p_addr, p_port, p_user, p_pass). Arguments three to six are the proxy host, proxy port, username and password; Net::HTTP.start takes the same positional arguments followed by options such as use_ssl.