Log user IP with PHP -


currently i'm using script log users ip adresses:

    $userip = $_server['remote_addr']; 

however, after bought anti-ddos http proxy, returns proxy ip instead.

    $_server['remote_addr'] -> 198.12.12.102 

i'm using cloudflare proxy, i've entered proxy's ip inside ip field in cloudflare , selected 'bypass cloudflare network'.

well, yes, if request proxied, php sees proxy's address. in case, and in case, should @ alternative http headers. proxy may, should, add original ip address http header, x-forwarded-for, available in $_server['http_x_forwarded_for'].

usually it's security risk pay attention these headers; if know your proxy you control explicitly adds header on your behalf should use it.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -