Skip to content

Commit

Permalink
6239-rate-limiting-prep
Browse files Browse the repository at this point in the history
  • Loading branch information
ttoomey committed Aug 1, 2024
1 parent f6c6194 commit 2a03657
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def append_info_to_payload(payload)
payload[:server_protocol] = request.env['SERVER_PROTOCOL']
payload[:remote_ip] = request.remote_ip
payload[:ip] = request.ip
payload[:remote_addr] = request.headers['REMOTE_ADDR']
payload[:remote_addr] = request.env['REMOTE_ADDR']
payload[:x_forwarded_for] = request.headers['HTTP_X_FORWARDED_FOR']
payload[:session_id] = request.env['rack.session.record'].try(:session_id)
payload[:user_id] = current_user&.id
Expand Down
3 changes: 2 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ class Application < Rails::Application
# FIXME: required to make forms in pjax modals work
config.action_controller.per_form_csrf_tokens = false

config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES
# Temporary: all of amazon
TodoOrDie('trused proxy, only for testing', by: '2024-8-15')
config.action_dispatch.trusted_proxies = [IPAddr.new('44.192.0.0/11')] if Rails.env.staging?
config.action_dispatch.trusted_proxies += [IPAddr.new('44.192.0.0/11')] if Rails.env.staging?

# Extension points
config.sub_populations = {}
Expand Down

0 comments on commit 2a03657

Please sign in to comment.