<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>ProxyMesh Blog - ruby</title><link href="https://proxymesh.com/posts/" rel="alternate"/><link href="https://proxymesh.com/posts/feeds/tag-ruby.atom.xml" rel="self"/><id>https://proxymesh.com/posts/</id><updated>2026-11-13T00:00:00+00:00</updated><subtitle>Features, open-source releases, proxy and scraping news from ProxyMesh.</subtitle><entry><title>ruby-proxy-headers 0.3.0 fixes CONNECT headers and Typhoeus</title><link href="https://proxymesh.com/posts/ruby-proxy-headers-0-3-0/" rel="alternate"/><published>2026-11-13T00:00:00+00:00</published><updated>2026-11-13T00:00:00+00:00</updated><author><name>ProxyMesh</name></author><id>tag:proxymesh.com,2026-11-13:/posts/ruby-proxy-headers-0-3-0/</id><summary type="html">&lt;p&gt;ruby-proxy-headers 0.3.0 requires Ruby 3.2 or later, sends Typhoeus proxy headers on CONNECT, and fixes Net::HTTP, HTTP.rb, RestClient, and Faraday.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="https://github.com/proxymesh/ruby-proxy-headers"&gt;ruby-proxy-headers&lt;/a&gt; 0.3.0
fixes HTTPS requests that send proxy headers through Typhoeus, HTTP.rb, and
RestClient, which failed in 0.2.3. It also requires Ruby 3.2 or newer. If you
run Ruby 3.2 or newer, upgrade. If you run Ruby 3.1, stay on 0.2.3.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;gem&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;ruby-proxy-headers
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In your &lt;code&gt;Gemfile&lt;/code&gt;, use &lt;code&gt;gem 'ruby-proxy-headers', '~&amp;gt; 0.3.0'&lt;/code&gt;, then run
&lt;code&gt;bundle update ruby-proxy-headers&lt;/code&gt;. The gem doesn't install Typhoeus, Faraday,
or the other clients, so you add the one you use.&lt;/p&gt;
&lt;h2 id="typhoeus-httprb-and-restclient-requests-now-work"&gt;Typhoeus, HTTP.rb, and RestClient requests now work&lt;/h2&gt;
&lt;p&gt;In 0.2.3, HTTPS requests with proxy headers through Typhoeus, HTTP.rb, and
RestClient failed. They work in 0.3.0, and you don't need to change your code.&lt;/p&gt;
&lt;p&gt;Typhoeus now sends your proxy headers and gives you the proxy's reply in
&lt;code&gt;proxy_response_headers&lt;/code&gt;, including &lt;code&gt;X-ProxyMesh-IP&lt;/code&gt;. &lt;code&gt;response.headers&lt;/code&gt; still
holds the website's response. With HTTP.rb and RestClient, you read
&lt;code&gt;response.proxy_response_headers&lt;/code&gt;. This needs Typhoeus 1.7 or the &lt;code&gt;http&lt;/code&gt; gem 6
or newer.&lt;/p&gt;
&lt;h2 id="nethttp-uses-your-installed-net-http-settings"&gt;Net::HTTP uses your installed net-http settings&lt;/h2&gt;
&lt;p&gt;0.3.0 works with the timeouts and HTTPS proxy settings of the net-http you have
installed, and you can still send extra CONNECT headers and read the proxy's
reply. You still call &lt;code&gt;RubyProxyHeaders::NetHTTP.patch!&lt;/code&gt; once before you create
connections.&lt;/p&gt;
&lt;h2 id="ruby-32-or-newer-is-required"&gt;Ruby 3.2 or newer is required&lt;/h2&gt;
&lt;p&gt;0.3.0 needs Ruby 3.2 or newer. On Ruby 3.1, stay on 0.2.3 by pinning it in your
&lt;code&gt;Gemfile&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ruby-proxy-headers&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;0.2.3&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="faraday-works-with-current-faraday-net_http"&gt;Faraday works with current faraday-net_http&lt;/h2&gt;
&lt;p&gt;0.3.0 works with faraday-net_http 3.4 and 3.5, and you don't need to change
your Faraday code. &lt;code&gt;res.headers['X-ProxyMesh-IP']&lt;/code&gt; still works.&lt;/p&gt;
&lt;h2 id="example-read-the-proxy-ip-with-typhoeus"&gt;Example: read the proxy IP with Typhoeus&lt;/h2&gt;
&lt;p&gt;Use &lt;a href="https://docs.proxymesh.com/article/80-proxy-server-locations"&gt;Proxy Server Locations&lt;/a&gt;
to find the host and port for &lt;code&gt;PROXY_HOST:PORT&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ruby_proxy_headers/typhoeus&amp;#39;&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="no"&gt;RubyProxyHeaders&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Typhoeus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;https://api.ipify.org?format=json&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="ss"&gt;proxy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;http://USERNAME:PASSWORD@PROXY_HOST:PORT&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="ss"&gt;proxy_headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;X-ProxyMesh-Country&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;US&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;proxy_response_headers&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;X-ProxyMesh-IP&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Look for the proxy IP in &lt;code&gt;response.proxy_response_headers&lt;/code&gt;, not in
&lt;code&gt;response.headers&lt;/code&gt;. &lt;code&gt;X-ProxyMesh-Country&lt;/code&gt; works only on the World and Open
proxies, and the
&lt;a href="https://docs.proxymesh.com/article/7-request-response-headers"&gt;request and response headers article&lt;/a&gt;
lists every header ProxyMesh accepts and returns. The
&lt;a href="https://docs.proxymesh.com/article/117-ruby-proxy-configuration-examples"&gt;Ruby proxy configuration examples&lt;/a&gt;
cover the other clients.&lt;/p&gt;
&lt;p&gt;Links: &lt;a href="https://rubygems.org/gems/ruby-proxy-headers/versions/0.3.0"&gt;ruby-proxy-headers 0.3.0 on RubyGems&lt;/a&gt;,
the &lt;a href="https://github.com/proxymesh/ruby-proxy-headers/releases/tag/v0.3.0"&gt;GitHub release&lt;/a&gt;,
the &lt;a href="https://github.com/proxymesh/ruby-proxy-headers/compare/v0.2.3...v0.3.0"&gt;full diff from 0.2.3&lt;/a&gt;,
the &lt;a href="https://github.com/proxymesh/ruby-proxy-headers/blob/v0.3.0/CHANGELOG.md"&gt;changelog&lt;/a&gt;,
and the &lt;a href="https://www.rubydoc.info/gems/ruby-proxy-headers"&gt;API docs on RubyDoc&lt;/a&gt;.&lt;/p&gt;</content><category term="Releases"/><category term="release"/><category term="ruby"/><category term="https"/></entry></feed>