How to add a proxy server to Ruby Geocoder
Approximate time to read: 1 min
One undocumented feature is its ability to route all requests through a proxy server. This can be very useful when trying to use Ruby Geocoder* with Heroku or other PaaS that hide behind shared ip addresses as it allows you to reclaim your daily request usage from Google. This example shows it using the QuotaGuard proxy. Note that for unauthenticated connections you don’t need the _username:password@* prefix.
Its also a good idea to up the timeout a bit as going through a proxy may slow your request down.
config/initializers/geocoder.rb
Geocoder.configure(
...
:http_proxy => 'username:password@http://quotaguard.com:9292',
:timeout => 5
)