{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/22953","labels_url":"https://api.github.com/repos/rails/rails/issues/22953/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/22953/comments","events_url":"https://api.github.com/repos/rails/rails/issues/22953/events","html_url":"https://github.com/rails/rails/pull/22953","id":125300119,"number":22953,"title":"stop reversing forwarded ips","user":{"login":"michaelrkn","id":1266530,"avatar_url":"https://avatars.githubusercontent.com/u/1266530?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelrkn","html_url":"https://github.com/michaelrkn","followers_url":"https://api.github.com/users/michaelrkn/followers","following_url":"https://api.github.com/users/michaelrkn/following{/other_user}","gists_url":"https://api.github.com/users/michaelrkn/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelrkn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelrkn/subscriptions","organizations_url":"https://api.github.com/users/michaelrkn/orgs","repos_url":"https://api.github.com/users/michaelrkn/repos","events_url":"https://api.github.com/users/michaelrkn/events{/privacy}","received_events_url":"https://api.github.com/users/michaelrkn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/actionpack","name":"actionpack","color":"FFF700"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-07T01:11:13Z","updated_at":"2016-01-07T01:22:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/22953","html_url":"https://github.com/rails/rails/pull/22953","diff_url":"https://github.com/rails/rails/pull/22953.diff","patch_url":"https://github.com/rails/rails/pull/22953.patch"},"body":"The first IP address in `X-Forwarded-For` is the original client. Currently, the order of the IP addresses is reversed, so if multiple proxies have forwarded the request, `calculate_ip` will return the final proxy, rather than the original client. This commit stops reversing the order, so that the original client is returned rather than the final proxy."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/169516218","html_url":"https://github.com/rails/rails/pull/22953#issuecomment-169516218","issue_url":"https://api.github.com/repos/rails/rails/issues/22953","id":169516218,"user":{"login":"michaelrkn","id":1266530,"avatar_url":"https://avatars.githubusercontent.com/u/1266530?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelrkn","html_url":"https://github.com/michaelrkn","followers_url":"https://api.github.com/users/michaelrkn/followers","following_url":"https://api.github.com/users/michaelrkn/following{/other_user}","gists_url":"https://api.github.com/users/michaelrkn/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelrkn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelrkn/subscriptions","organizations_url":"https://api.github.com/users/michaelrkn/orgs","repos_url":"https://api.github.com/users/michaelrkn/repos","events_url":"https://api.github.com/users/michaelrkn/events{/privacy}","received_events_url":"https://api.github.com/users/michaelrkn/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T01:22:30Z","updated_at":"2016-01-07T01:22:30Z","body":"Just to give some background on this, I ran into this problem when using `request.remote_ip` in an app hosted on Heroku sitting behind Cloudflare. We were getting Cloudflare's IP rather than the clients'. According to http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/x-forwarded-headers.html, it's standard for the client to be the first address in the header."}}