Fixes #6012: Gets correct client IP behind proxy (1.8)
Checks X-Real-Ip header as well when determining client IP