Use configured hostname instead of getHostName, see #2997

* getHostName may trigger reverse name lookup
* use the configured hostname in all places