add function to use x_forwarded_for or remote_addr if x_forwarded_for is not set to get the remote client ip