Overwrites the X_FORWARDED_FOR
HTTP header with the contents of
CF_CONNECTING_IP
if it's present. This makes request.remote_ip
in
Rails return the IP of the user making the request rather than the IP of
a Cloudflare server.
Add this line to your application's Gemfile:
gem 'rack-cloudflare_ip'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-cloudflare_ip
In config/application.rb
:
require "rack/cloudflare_ip"
config.middleware.use Rack::CloudflareIp
- Fork it ( http://github.com/ms-digital-labs/rack-cloudflare_ip/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request