Handle "localhost" better

Refs #4263