Skip to content

Support sending X-Forwarded-For header

Latest

Choose a tag to compare

@paulspringett paulspringett released this 04 Mar 10:58
· 2 commits to master since this release

Configure a lambda to set to a X-Forwarded-For header on outgoing requests:

FlexCommerceApi.config do |config|
  config.forwarded_for = ->{ RequestStore[:request_ip] }
end

In a Rails app you might set this as follows:

# application_controller.rb
class ApplicationController
  before_action :set_request_ip

  private

  def set_request_ip
    RequestStore[:request_ip] = request.remote_ip
  end
end