This was a misconfiguration of IPv6 on the web server. Emacs was waiting for the connection to timeout to initiate IPv4 connection.