Skip to content

Instantly share code, notes, and snippets.

@dlackty
Created July 28, 2016 16:24
Show Gist options
  • Save dlackty/6e4fc6d342f61df3ad29c1fa2c5712f0 to your computer and use it in GitHub Desktop.
Save dlackty/6e4fc6d342f61df3ad29c1fa2c5712f0 to your computer and use it in GitHub Desktop.
ActionDispatch::RemoteIp trusted proxies for CloudFront
trusted_proxies = ["52.84.0.0/15",
"54.182.0.0/16",
"54.192.0.0/16",
"54.230.0.0/16",
"54.239.128.0/18",
"54.239.192.0/19",
"54.240.128.0/18",
"204.246.164.0/22",
"204.246.168.0/22",
"204.246.174.0/23",
"204.246.176.0/20",
"205.251.192.0/19",
"205.251.249.0/24",
"205.251.250.0/23",
"205.251.252.0/23",
"205.251.254.0/24",
"216.137.32.0/19"].map do |proxy|
IPAddr.new(proxy)
end
Rails.application.config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES + trusted_proxies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment