Welcome Guest, Not a member yet? Register   Sign In
Retrieving visitor ip address in sessions table
#1

Hi all.
I have recently added an AWS Load Balancer to my CI based web app.
Previously, the visitor's ip address was passing through to the server instance and sessions table fine. However, after adding the LB to the setup, I no longer get the ip address of the visitor. Instead, I get one of the 2 private ip addresses associated with the load balancer.
I have followed AWS support's guidance and ensured that the load balancer's X-Forwarded-For header attribute is set to 'preserve'. However, still no luck.
I have printed an array of the $_SERVER variable. It returns the LB's ip address to the following:
[REMOTE_ADDR]
[HTTP_X_REAL_IP]
It doesn't seem to be returning any mention of a [HTTP_X_FORWARDED_FOR] header at all and no mention anywhere of the visitor's ip address in the headers at all..
Can anyone suggest where I should be looking in order to ensure that the visitor's ip address is passed and picked up by my website?
Is it an apache/nginx setting/issue?
Thanks a lot for any assistance you can provide.
Gareth
Reply
#2

Do you have mod_remoteip installed for apache?

See: https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
Reply
#3

Thanks. Yes, it is installed:
root@ip-xxx-xx-x-xxx:/home/ubuntu# apachectl -M | grep remoteip
remoteip_module (shared)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB