<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *2.3.0 [Edge]*
 
+* Allow users to opt out of the spoofing checks in Request#remote_ip.  Useful for sites whose traffic regularly triggers false positives. [Darren Boyd]
+
 * Deprecated formatted_polymorphic_url.  [Jeremy Kemper]
 
 * Added the option to declare an asset_host as an object that responds to call (see http://github.com/dhh/asset-hosting-with-minimum-ssl for an example) [DHH]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -327,6 +327,10 @@ module ActionController #:nodoc:
     # sets it to &lt;tt&gt;:authenticity_token&lt;/tt&gt; by default.
     cattr_accessor :request_forgery_protection_token
 
+    # Controls the IP Spoofing check when determining the remote IP.
+    @@ip_spoofing_check = true
+    cattr_accessor :ip_spoofing_check
+
     # Indicates whether or not optimise the generated named
     # route helper methods
     cattr_accessor :optimise_named_routes</diff>
      <filename>actionpack/lib/action_controller/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -218,7 +218,7 @@ module ActionController
       remote_ips = @env['HTTP_X_FORWARDED_FOR'] &amp;&amp; @env['HTTP_X_FORWARDED_FOR'].split(',')
 
       if @env.include? 'HTTP_CLIENT_IP'
-        if remote_ips &amp;&amp; !remote_ips.include?(@env['HTTP_CLIENT_IP'])
+        if ActionController::Base.ip_spoofing_check &amp;&amp; remote_ips &amp;&amp; !remote_ips.include?(@env['HTTP_CLIENT_IP'])
           # We don't know which came from the proxy, and which from the user
           raise ActionControllerError.new(&lt;&lt;EOM)
 IP spoofing attack?!</diff>
      <filename>actionpack/lib/action_controller/request.rb</filename>
    </modified>
    <modified>
      <diff>@@ -66,6 +66,15 @@ class RequestTest &lt; ActiveSupport::TestCase
     assert_match /HTTP_X_FORWARDED_FOR=&quot;9.9.9.9, 3.4.5.6, 10.0.0.1, 172.31.4.4&quot;/, e.message
     assert_match /HTTP_CLIENT_IP=&quot;8.8.8.8&quot;/, e.message
 
+    # turn IP Spoofing detection off.
+    # This is useful for sites that are aimed at non-IP clients.  The typical
+    # example is WAP.  Since the cellular network is not IP based, it's a
+    # leap of faith to assume that their proxies are ever going to set the
+    # HTTP_CLIENT_IP/HTTP_X_FORWARDED_FOR headers properly.
+    ActionController::Base.ip_spoofing_check = false
+    assert_equal('8.8.8.8', @request.remote_ip(true))
+    ActionController::Base.ip_spoofing_check = true
+
     @request.env['HTTP_X_FORWARDED_FOR'] = '8.8.8.8, 9.9.9.9'
     assert_equal '8.8.8.8', @request.remote_ip(true)
 </diff>
      <filename>actionpack/test/controller/request_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>97403ad5fdfcdfb2110c6f8fd0ebf43b7afc4859</id>
    </parent>
  </parents>
  <author>
    <name>Darren Boyd</name>
    <email>dboyd@tapiocamobile.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/0a4a5f3129a137fc357e8444a08b135f0ad4fbe8</url>
  <id>0a4a5f3129a137fc357e8444a08b135f0ad4fbe8</id>
  <committed-date>2008-12-01T11:40:18-08:00</committed-date>
  <authored-date>2008-11-22T10:04:30-08:00</authored-date>
  <message>Making the IP Spoofing check in AbstractRequest#remote_ip configurable.

Certain groups of web proxies do not set these values properly.  Notably,
proxies for cell phones, which often do not set the remote IP information
correctly (not surprisingly, since the clients do not have an IP address).

Allowing this to be configurable makes it possible for developers to choose
to ignore this simple spoofing check, when a significant amount of their
traffic would result in false positives anyway.

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;

[#1200 state:committed]</message>
  <tree>876fdcd3bc5b8a92431dd82f74b20ace72c1c488</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
