You should add an option to the code that detects or that can be configurable for this. When the site is behind a squid proxy/cache that acts as web accel the IP that comes with REMOTE_ADDR is the squid server IP, and it should be another varible, HTTP_X_FORWARDED_FOR.
This variable also can contain more than one IP, like 1.2.3.4,127.0.0.1 if the user is using also a proxy/cache.
I don't know if the IP is used by akismet, but if it is used, then on sites like mine, with http accel infront, akismet doesn't work very well.
Thanks