0

I'm running passenger on nginx and have a rails app server. I'm unable to get the user's remote IP.. how can I get the User's IP?

I use a nginx.conf.erb which I can modify if needed..

The problem (I think) arises in google container engine which creates a load balancer in front of my app.. making request.remote_ip only get a local kubernetes cluster-ip rather than the remote ip..

sambehera
  • 959
  • 3
  • 13
  • 33
  • 1
    Possible duplicate of [Rails: Get Client IP address](http://stackoverflow.com/questions/4465476/rails-get-client-ip-address) – Jonathan Jul 19 '16 at 16:39
  • 1
    @Jonathan nope -- this is specific to kubernetes and/or google container engine – sambehera Jul 23 '16 at 17:23

1 Answers1

0

That should be pretty simple, infact you don't have to pass it from Nginx it always comes to rails as headers. You can access it as follows,

request.remote_ip
Pragash
  • 713
  • 7
  • 9