I recently had to debug a “502 Bad Gateway” error when trying to proxy Elasticsearch with a self-signed certificate through Traefik. The logs showed Elasticsearch rejecting the connection with received plaintext http traffic on an https channel, while Traefik was happily forwarding HTTP requests to what it thought was an HTTP backend.