Typhoeus Proxy Configuration
Typhoeus is a Ruby binding to libcurl. Pass proxy: with your full ProxyMesh URL (see proxy-examples/ruby/typhoeus-proxy.rb). For HTTPS with custom CONNECT headers, RubyProxyHeaders::Typhoeus delegates to the Net::HTTP integration when needed.
Installation
gem install typhoeus ruby-proxy-headers
Basic Proxy Configuration
require 'typhoeus'
request = Typhoeus::Request.new(
'https://api.ipify.org?format=json',
proxy: 'http://username:password@proxyhost:31280',
ssl_verifypeer: true,
ssl_verifyhost: 2
)
response = request.run
puts response.body
Custom Proxy Headers
require 'ruby_proxy_headers/typhoeus'
response = RubyProxyHeaders::Typhoeus.get(
'https://api.ipify.org?format=json',
proxy: 'http://username:password@proxyhost:31280',
proxy_headers: { 'X-ProxyMesh-Country' => 'US' }
)
puts response.body
puts response.proxy_response_headers['X-ProxyMesh-IP']
ProxyMesh Headers Reference
Send these headers to control proxy behavior:
X-ProxyMesh-Country- Route through a specific country (e.g., "US"). Only works with world proxy or open proxyX-ProxyMesh-IP- Request a specific outgoing IP addressX-ProxyMesh-Not-IP- Exclude specific IPs from rotation
The proxy returns X-ProxyMesh-IP with the IP address used for the request (when your stack exposes CONNECT response headers).
Resources
- Typhoeus Documentation
- Typhoeus on RubyGems
- Typhoeus on RubyDoc
- ruby-proxy-headers (Typhoeus)
- ruby-proxy-headers on RubyGems
- ruby-proxy-headers on RubyDoc
- ProxyMesh Headers Reference
- Example Code on GitHub
Related Ruby Proxy Guides
Explore proxy configuration for other Ruby HTTP libraries: