Throws no error but also doesnt establish a https connection http is working fine

Hello Traefik-Community,

I got into a project where i am currently alone and also the ones working on it before don't bother to help... I was only working in the files not directly correlating to docker so I am quite new in the field. I have removed docker swarm and stack because i was told to do so the containers are running and everything looks fine until you want to connect to https. The logs of the traefik instance has only one message: level=info msg="Configuration loaded from flags.
I tried coping a few tutorials online, but i get confused because this project has more containers running. Here is the docker-compose.yml...: I am very grateful for any help! If it helps I think the project was made a long time ago with a project generator. Thank you in advance!

services:
proxy:
image: traefik:v2.11
networks:
- traefik-public
- default
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-public-certificates:/certificates
command:
- --log.level=DEBUG
- --providers.docker
- --providers.docker.exposedbydefault=false
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
- --certificatesresolvers.le.acme.email=myemail
- --certificatesresolvers.le.acme.storage=/certificates/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
- --accesslog
- --log
- --api
environment:
- TRAEFIK_PUBLIC_TAG=${TRAEFIK_PUBLIC_TAG}

labels:
  - traefik.enable=true
  - traefik.docker.network=traefik-public
  - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
  - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
  - traefik.http.routers.proxy-http.rule=Host(`theactualdomain.de`) || Host(`www.theactualdomain.de`)
  - traefik.http.routers.proxy-http.entrypoints=http
  - traefik.http.routers.proxy-http.middlewares=https-redirect
  - traefik.http.routers.proxy-https.rule=Host(`theactualdomain.de`) || Host(`www.theactualdomain.de`)
  - traefik.http.routers.proxy-https.entrypoints=https
  - traefik.http.routers.proxy-https.tls=true
  - traefik.http.routers.proxy-https.tls.certresolver=le

db:
image: postgres:12
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata

pgadmin:
image: dpage/pgadmin4:2021-04-19-1
networks:
- traefik-public
- default
env_file:
- .env
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.pgadmin-http.rule=Host(pgadmin.theactualdomain.de)
- traefik.http.routers.pgadmin-http.entrypoints=http
- traefik.http.routers.pgadmin-http.middlewares=https-redirect
- traefik.http.routers.pgadmin-https.rule=Host(pgadmin.theactualdomain.de)
- traefik.http.routers.pgadmin-https.entrypoints=https
- traefik.http.routers.pgadmin-https.tls=true
- traefik.http.routers.pgadmin-https.tls.certresolver=le
- traefik.http.services.pgadmin.loadbalancer.server.port=5050

backend:
image: '${DOCKER_IMAGE_BACKEND}:${TAG-latest}'
volumes:
- pictures:/var/lib/pictures
- profilepictures_user:/var/lib/profilepictures_user
env_file:
- .env
environment:
- SERVER_NAME=theactualdomain.de
- SERVER_HOST=https://theactualdomain.de
build:
context: ./backend
dockerfile: backend.dockerfile

labels:
  - traefik.enable=true
  - traefik.http.routers.backend-http.rule=PathPrefix(`/api`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`)
  - traefik.http.services.backend-service.loadbalancer.server.port=80

frontend:
image: '${DOCKER_IMAGE_FRONTEND}:${TAG-latest}'
build:
context: ./frontend
args:
FRONTEND_ENV: ${FRONTEND_ENV-production}
labels:
- traefik.enable=true
- traefik.http.routers.frontend-http.rule=PathPrefix(/)
- traefik.http.services.frontend-service.loadbalancer.server.port=80

volumes:
app-db-data:
pictures:
profilepictures_user:
traefik-public-certificates:

networks:
traefik-public:
external: false

Use 3 backticks before and after code/config to make it more readable and preserve spacing, which is important in yaml.

Are you behind a firewall?

Thank you for your answer! I am behind a firewall but I dont get any logs in the docker logs [TRAEFIK_CONTAINER]. Only the
level=info msg="Configuration loaded from flags."
shouldnt i get at least some information here?

So we can read your config!

1 Like

Here is the config in the (hopefully) right format. I hope it can be read easily now. :slight_smile:

services:
  proxy:
    image: traefik:v2.11
    networks:
      - traefik-public
      - default
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - traefik-public-certificates:/certificates
    command:
      - "--log.level=DEBUG" 
      - "--providers.docker"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.http.address=:80"
      - "--entrypoints.https.address=:443"
      - "--certificatesresolvers.le.acme.email=actual@email.de"
      - "--certificatesresolvers.le.acme.storage=/certificates/acme.json"
      - "--certificatesresolvers.le.acme.tlschallenge=true"
      - "--accesslog"
      - "--log"
      - "--api"
    environment:
      - TRAEFIK_PUBLIC_TAG=${TRAEFIK_PUBLIC_TAG}
      - EMAIL=actual@email.de

    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
      - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
      - traefik.http.routers.proxy-http.rule=Host(`actualaddress.de`) || Host(`www.actualaddress.de`)
      - traefik.http.routers.proxy-http.entrypoints=http
      - traefik.http.routers.proxy-http.middlewares=https-redirect
      - traefik.http.routers.proxy-https.rule=Host(`actualaddress.de`) || Host(`www.actualaddress.de`)
      - traefik.http.routers.proxy-https.entrypoints=https
      - traefik.http.routers.proxy-https.tls=true
      - traefik.http.routers.proxy-https.tls.certresolver=le

  db:
    image: postgres:12
    volumes:
      - app-db-data:/var/lib/postgresql/data/pgdata
    env_file:
      - .env
    environment:
      - PGDATA=/var/lib/postgresql/data/pgdata

  pgadmin:
    image: dpage/pgadmin4:2021-04-19-1
    networks:
      - traefik-public
      - default
    env_file:
      - .env
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.http.routers.pgadmin-http.rule=Host(`pgadmin.actualaddress.de`)
      - traefik.http.routers.pgadmin-http.entrypoints=http
      - traefik.http.routers.pgadmin-http.middlewares=https-redirect
      - traefik.http.routers.pgadmin-https.rule=Host(`pgadmin.actualaddress.de`)
      - traefik.http.routers.pgadmin-https.entrypoints=https
      - traefik.http.routers.pgadmin-https.tls=true
      - traefik.http.routers.pgadmin-https.tls.certresolver=le
      - traefik.http.services.pgadmin.loadbalancer.server.port=5050

  backend:
    image: '${DOCKER_IMAGE_BACKEND}:${TAG-latest}'
    volumes:
      - pictures:/var/lib/pictures
      - profilepictures_user:/var/lib/profilepictures_user
    env_file:
      - .env
    environment:
      - SERVER_NAME=actualaddress.de
      - SERVER_HOST=https://actualaddress.de
    build:
      context: ./backend
      dockerfile: backend.dockerfile

    labels:
      - traefik.enable=true
      - traefik.http.routers.backend-http.rule=PathPrefix(`/api`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`)
      - traefik.http.services.actualname-de-backend.loadbalancer.server.port=80

  frontend:
    image: '${DOCKER_IMAGE_FRONTEND}:${TAG-latest}'
    build:
      context: ./frontend
      args:
        FRONTEND_ENV: ${FRONTEND_ENV-production}
    labels:
      - traefik.enable=true
      - traefik.http.routers.frontend-http.rule=PathPrefix(`/`)
      - traefik.http.services.actualname-de-frontend.loadbalancer.server.port=80

volumes:
  app-db-data:
  pictures:
  profilepictures_user:
  traefik-public-certificates:

networks:
  traefik-public:
    external: false

Thanks for your time!

Cleanup your config, move repetitive parts from dynamic to static config, see simple Traefik example.

Make sure to use rule=Host() && PathPrefix() so Traefik knows which LetsEncrypt TLS cert (domain) should be used.

1 Like