Set correct clientIp when using a proxy server with x-forwarded-for

Fixes issue #357