Minor fixes.
Fix msg logging.
Add X-Forwarded-For as REMOTE_ADDR if behind proxy.