Build Status

Simple gem that extends Rails request.remote_ip to default to Cloudflare's HTTP_CF_CONNECTING_IP header. More about CloudFlare HTTP Headers and why we choose to trust CF-Connecting-IP.


Add this line to your Rails application's Gemfile:

gem 'actionpack-cloudflare'


None! Just install and feel confident that request.remote_ip is doing its job.


  • cloudflare-rails - Leverages cached HTTP requests to Cloudflare to extend Rails' trusted proxies list.


We use the Appraisal gem from Thoughtbot to help us test different versions of Rails. The appraisal rake test subcommand runs our test suite against all Rails versions in the Appraisal file. So after cloning the repo, running the following commands.

$ bundle install
$ bundle exec appraisal update
$ bundle exec appraisal rake test

If you want to run the tests for a specific appraisal, use one of the names found in our Appraisal file. For example, the following will run our tests suite for Rails 4.2 only.

$ bundle exec appraisal rails42 rake test


The gem is available as open source under the terms of the MIT License.