Welcome Guest, Not a member yet? Register   Sign In
proxy_ips or Why does every visitor to my website have the same IP address?
#1

[eluser]jackbenning[/eluser]
I'm using ci_sessions with the databse option.
I'm on a clustered hosting solution.
ci_sessions is working, but every visitor to my website have the same IP address???
My hosting provider say if I want to get correct client IP address, I need to replace REMOTE_ADDR with: HTTP_X_FORWARDED_FOR

How can I do this in CI? What's the best way?
WIll using proxy_ips in my config file work? If so, how do I use it?
#2

[eluser]slowgary[/eluser]
The HTTP_X_FORWARDED_FOR is not part of the standard, so there's no guarantee that a proxy will send that header, or that it will be accurate. Wikipedia mentions checking the proxy server against a whitelist, but this woould require you to also know which proxies send the header honestly.

I don't think relying on the IP address for sessions is ever recommended. Not only do you run into problems like your proxy issue, but an IP address is easily spoofed. I'm not great with sessions, but I would think just getting a GUID as the session identifier would be better. Store it in a cookie or something.
#3

[eluser]jackbenning[/eluser]
Any more ideas from the ether?
#4

[eluser]TheFuzzy0ne[/eluser]
Ask your host why you should have to do that, when it works properly for everyone else, and tell them you're using a framework.

CodeIgniter is built to run on virtually any server, if the server can't run CodeIgniter properly (with just a bit of configuration), it might be time to find a better host.

Just out of interest, what IP address do you get? Is it an internal IP?




Theme © iAndrew 2016 - Forum software by © MyBB