Last IP address and action_dispatch.trusted_proxies

You might need to remove some address ranges from TRUSTED_PROXIES, by the sound of it.