Skip to content

quipper/real_ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RealIp

Rack middleware to get client IP address on Heroku, extracted from our API service.

Installation

Add this line to your application's Gemfile:

gem 'real_ip', github: 'quipper/real_ip'

And then execute:

$ bundle

Or install it yourself as:

$ gem install real_ip

Usage

  1. Mount RealIp rack middleware at the top of your Rack application's middleware stack.

Rack (config.ru)

require 'real_ip'
use RealIp

Rails (config/application.rb or config/environments/*.rb)

module MyApp
  class Application < Rails::Application
    config.middleware.insert 0, 'RealIp'
  end
end

MyApp::Application.configure do
  config.middleware.insert 0, 'RealIp'
end
  1. On your controller, use request.env['QUIPPER_REMOTE_ADDR'] to get the IP address

Contributing

  1. Fork it ( https://github.com/[my-github-username]/real_ip/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Rack middleware to get client IP address on Heroku, extracted from our API service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published