Improve remoteAddress substitution for localhost