Traefik reverse proxy doesn't work

Hello everyone,

I need help for the configuration of the traefik reverse proxy in docker.

In following many tutorials or forums to configure it, I was not able to set up my docker environment with a reverse proxy.

Here is the configuration files:

  • traefik.toml:
#[accesslog]
#[global]
#  sendAnonymousUsage = false

#[log]
#  level = "INFO"
  #format = "common"
 
#defaultEntryPoints = ["http", "https"]

logLevel = "INFO"

[docker]
  endpoint = "unix:///var/run/docker.sock"
  exposedByDefault = false

#[providers]
#  [providers.docker]
#    endpoint = "unix:///var/run/docker.sock"
#    domain = "xxxxxxx.xxxxx.com"
#    watch = true
#    exposedByDefault = true
#    swarmMode = false
#  [providers.file]
#    filename: /etc/traefik/config.yml
#    watch: true

[api]
  dashboard = true
  debug = true
  insecure = true

defaultEntryPoints=["http","https"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  #[entryPoints.web.http.redirections.entrypoint]
  #  scheme="https"
  #  to="secure"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.secure.tls.certificates]]
      certFile="/certs/tls.crt"
      keyFile="/certs/tls.key"
  [entryPoints.dashboard]
  address = ":8080"

[retry]

#[certificatesResolvers]
#  [certificatesResolvers.letsencrypt]
#    [certificatesResolvers.letsencrypt.acme]
#      email = "docker@xxxxx.xxxxxx.com"
#      storage = "acme.json"
#      caServer = "https://acme-v02.api.letsencrypt.org/directory"
#      keyType = "EC256"
#      [certificatesResolvers.letsencrypt.acme.httpChallenge]
#        entryPoint = "insecure"

[acme]
email = "docker@xxxxxx.xxxxxx.com"
storage = "./acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"

  • docker-compose.yml:
mytb:
    restart: always
    image: "thingsboard/tb-postgres"
    ports:
      - "8081:9090"
      - "2883:1883"
      - "5683:5683/udp"
    environment:
      TB_QUEUE_TYPE: in-memory
    volumes:
      - ./tb/.mytb-data:/data
      - ./tb/.mytb-logs:/var/log/thingsboard
    labels:
#      - traefik.docker.network=traefik-network
      - traefik.enable=true
      - traefik.frontend.rule=Host:xxxxxx.xxxxxx.com
      - traefik.port=8080
#      - traefif.basic.protocol=http
#      - traefik.admin.frontend.rule=Host:xxxxxx.xxxxxx.com
#      - traefik.admin.protocol=https
#      - traefik.admin.port=9443
#      - traefik.http.routers.thingtest.rule=Host(`xxxxxxxx.xxxxxx.com`)
#      - traefik.http.routers.thingtest.tls=true
    networks:
      - traefik-network
#    healthcheck:
#      test: ["CMD", "curl", "-f", "http://xxxxx.xxxxx.com:8080/"]
#      interval: 30s
#      timeout: 10s
#      retries: 9

  traefik:
    image: traefik:alpine
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

      #- ./traefik/.conf/traefik_dynamic.yml:/etc/traefik/config.yml
      #- ./traefik/.conf/traefik.yml:/etc/traefik/traefik.yml

      - ./traefik/.conf/traefik.toml:/traefik/traefik.toml
      #- ./traefik/.conf/acme.json:/acme.json
      - ./traefik/.certs:/certs
      #- ./traefik/.conf/:/etc/traefik/conf.d/
    labels:
      - traefik.enable=true
      - traefik.port=8080
      - traefik.frontend.rule=Host:traefik.perax.com
      - traefik.http.routers.traefik=true
      - traefik.http.routers.THINGTEST.rule=Host:xxxxxxx.xxxxxxx.com
      - traefik.http.routers.THINGTEST.entryPoints=http
      - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
      - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
      - traefik.http.middlewares.https-redirect.redirectscheme.port=443
      #- traefik.http.routers.THINGTEST-http.middlewares=https-redirect@docker
      - traefik.http.routers.THINGTEST-https.entrypoints=https
      - traefik.http.routers.THINGTEST-https.rule=Host:xxxxxxxxxx.xxxxxxx.com
      - traefik.http.routers.THINGTEST-https.tls=true
      - traefik.http.routers.THINGTEST-https.tls.certresolver=letsencrypt
      - traefik.http.routers.THINGTEST-https.tls.domains[0].main=xxxxxxxx.xxxxxxxx.com
      - traefik.http.routers.THINGTEST-https.tls.domains[0].sans=*.xxxxxxx.xxxxxx.com
    networks:
      - traefik-network

  custom_gateway:
    build: ./custom_gateway/
    restart: always


In thanking you very much for your help !

Hello @mrroot,

What version of Traefik are you running?

Your configuration provided is for v1, but I suspect you are pulling a v2 image.

Hello @daniel.tomcej,

Sorry for the late of my answer I finally found out a solution for my problem.

Thank you for your avaibility.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.