Added options for hostname and port selection. 502 and 504 errors now fly through for better visibility