I was also getting 502 Bad Gateway. The problem was that I was missing loading the http-bind module in ejabberd: {modules, [ ... {mod_http_bind, []},