Skip to content

Instantly share code, notes, and snippets.

@scarfacedeb
Created October 4, 2013 10:56
Show Gist options
  • Save scarfacedeb/6824222 to your computer and use it in GitHub Desktop.
Save scarfacedeb/6824222 to your computer and use it in GitHub Desktop.
# lib/spoof_ip.rb
class SpoofIp
def initialize(app, ip)
@app = app
@ip = ip
end
def call(env)
env['REMOTE_ADDR'] = env['action_dispatch.remote_ip'] = @ip
@status, @headers, @response = @app.call(env)
[@status, @headers, @response]
end
end
# config/development.rb
require 'spoof_ip'
config.middleware.use('SpoofIp', '64.71.24.19')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment