Fix to last patch: Use external_hostname variable for non-HTTPS hosts