[Solved] - Unable to reach container under https

Hello,

I'm trying to reach a whoami container under https on my local computer
To do so I've added those line to /etc/hosts

127.0.0.1 dummy.org
127.0.0.1 traefik.dummy.org
127.0.0.1 api.dummy.org

As recommended by lets encrypt I've used minica in order to generate a certificate

I've generated the certificate with ./minica --domains 'dummy.org,traefik.dummy.org,api.dummy.org
docker-compose.yml

services:
  traefik:
    image: traefik:v3.0
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik.yml:/etc/traefik/traefik.yml
      - ./conf.d/:/etc/traefik/conf.d/
      - ${PWD:-.}/certs/:/certs/


  whoami:
    image: "traefik/whoami"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.entrypoints=dummy,dummy_unsecure"
      - "traefik.http.routers.whoami.rule=Host(`api.dummy.org`)"

traefik.yml

## Static Configuration
log:
  level: DEBUG
  
# print access log
accessLog: {}

# enable dashboard on 8080 with auth
api:
#  insecure: true
  dashboard: true

entryPoints:
  dummy_unsecure:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: dummy
          scheme: https
  dummy:
    address: ":443"
    asDefault: true
    http:
      tls:
        domains:
          - main: dummy.org
            sans:
              - api.dummy.org


providers:
  docker: {}
  file:
    directory: /etc/traefik/conf.d/
    watch: true

Here is the dynamic configuration I've written in the conf.d directory
dynamic-config.yml

## Dynamic configuration

tls:
  certificates:
    - certFile: /certs/cert.pem
      keyFile: /certs/key.pem
      stores:
        - default

http:
  routers:
    dashboard:
      rule: Host(`traefik.dummy.org`)
      service: api@internal

I can access in https to treafik.dummy.org
When I try to reach the api.dummy.org in http its working fine
SOLVED - NOT ANYMORE: When I try to reach the api.dummy.org in https I'm meeting a 404

Do you have a clue of what I'm missing?

api router does not have TLS enabled, neither globally on entrypoint nor on router. Check simple Traefik example.

1 Like

Thanks a lot for you answer, even if the example, already read, wasn't usefull, your explaination of setting up the TLS for the entrypoint help me to understand what was wrong

I've added an

  • entryPoints.dummy.http.tls.domains.main
  • entryPoints.dummy.http.tls.domains.sans

In my traefik configuration and I can reach the whoami container, I've given a try to the v3 version, I was a bit afraid of it due to the gap after the v1 -> v2 changes and it worked like a charm, I've also added the useDefault

I'm modifying the originals post for the follow up
If ever you have some remarks to improve the solution please let me know

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