Use https for communicatio between traefik and docker container

I am using the tls branch of docker-elk which sets up all the docker containers using a self signed cert. The docker containers must be called using https.


  elasticsearch:
    build:
      context: elasticsearch/
      args:
        ELASTIC_VERSION: ${ELASTIC_VERSION}
    volumes:
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro,z
      - elasticsearch:/usr/share/elasticsearch/data:z
      # (!) TLS certificates. Generate using instructions from tls/README.md.
      - ./tls/elasticsearch/elasticsearch.p12:/usr/share/elasticsearch/config/elasticsearch.p12:ro,z
      - ./tls/elasticsearch/http.p12:/usr/share/elasticsearch/config/http.p12:ro,z
    ports:
      - "9200:9200"
      - "9300:9300"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.elasticsearch.rule=Host(`es.domain.com`)"
      - "traefik.http.routers.elasticsearch.entrypoints=https"
      - "traefik.http.routers.elasticsearch.tls.certresolver=lets-encrypt"

    networks:
      - elk
      - default

Currently all calls to https://es.domain.com are failing with a 502 Bad Gateway. Inside the elasticsearch container I see following error:

WARN received plaintext http traffic on an https channel, closing connection

How can I tell traefik to use https in order to call my elasticsearch container?

Hello @bollerdominik

Seems, you are looking for the following option to configure transport between Traefik and the backend service:

You can configure the client certificate or for testing purposes use insecure mode by setting insecureSkipVerify to true.

Please let us know if you solved the problem.