Vectorface / whip

A PHP class for retrieving accurate IP address information for the client.
MIT License
375 stars 19 forks source link

nginx #23

Closed martti-cloudkey closed 2 years ago

martti-cloudkey commented 4 years ago

Is it possible to add ability to get ip addresses from behind a nginx proxy? [HTTP_X_REAL_IP] => 80.235.6.194 [HTTP_X_FORWARDED_FOR] => 80.235.6.194 [HTTP_X_FORWARDED_PROTO] => https [HTTP_HOST] => oidprovider.com [HTTP_CONNECTION] => close [HTTP_UPGRADE_INSECURE_REQUESTS] => 1 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9 [HTTP_SEC_FETCH_SITE] => none [HTTP_SEC_FETCH_MODE] => navigate [HTTP_SEC_FETCH_USER] => ?1 [HTTP_SEC_FETCH_DEST] => document [HTTP_ACCEPT_ENCODING] => gzip, deflate, br [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.9,et;q=0.8,fi;q=0.7 [HTTP_COOKIE] => PHPSESSID=nlb325t04th0t2g0377bfp4ehf [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin [LD_LIBRARY_PATH] => /usr/local/apache2/lib

francislavoie commented 4 years ago

That should already work out of the box:

https://github.com/Vectorface/whip/blob/daa06bad325cff3fca5b870a5f167173ac88f4ad/src/Whip.php#L76

Did you try it?

francislavoie commented 2 years ago

Closing as inactive.