support@xlroutes.com
Login

    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 XLRoutes 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://xlroutes.com:9292',
      :timeout => 5 
    )