Reputation: 48453
I found through google my IP address and now I try to make a redirect based on the IP address.
To the HomeController#index I set followings:
unless request.remote_ip.to_s == '1.2.3.4'
redirect_to 'http://www.some_page.com'
return
end
But this doesn't works, because I am always redirected on the *some_page.com*... What I am doing wrong?
Upvotes: 0
Views: 891
Reputation: 14179
Are you trying this on a local machine? Then your "remote IP" from the server's point of view would always be 127.0.0.1, not your external IP.
Anyways, see what request.remote_ip
is actually returning. Maybe it'll shed some light.
Upvotes: 1