404 error with let's encrypt

Hello,

I'm facing a problem while deploying a Django app with Traefik. Despite successfully deploying the Django app with Traefik, I consistently encounter a 404 error on the website. However, the Traefik Dashboard is reachable as expected. Below you can check my docker-compose.yml file and traefik.toml
I still don't know what's missing. Can someone help? Thank you.

version: '3'

services:
  web:
    image: registry/web-app:0.1
    command: /start
    networks:
      - my-network
    env_file:
      - ./.env
    deploy:
      replicas: 2
      update_config:
        order: start-first
        failure_action: rollback
        delay: 5s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.django.rule=Host(`subdomain.example.com`)"
      - "traefik.http.routers.django.tls=true"
      - "traefik.http.routers.django.tls.certresolver=letsencrypt"
      - "traefik.http.services.django.loadbalancer.server.port=8000"
      - "traefik.http.routers.django.entrypoints=websecure"

  traefik:
    image: registry/custom-traefik:0.1
    ports:
      - '80:80'
      - '443:443'
    networks:
      - my-network
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik-public-certificates:/certificates"
    deploy:
      placement:
        constraints:
          # Make the traefik service run only on the node with this label
          # as the node with it has the volume for the certificates
          - node.hostname == node1
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.dashboard.rule=Host(`dashboard-sub.example.com`)"
        - "traefik.http.routers.dashboard.tls=true"
        - "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
        - "traefik.http.routers.dashboard.service=api@internal"
        - "traefik.http.routers.dashboard.middlewares=auth"
        - "traefik.http.middlewares.auth.basicauth.users=root:$$apr1$$B6aac2MA$$CO5KsssaZigOwWF1GQpZHCNf0"

networks:
  my-network:

volumes:
  traefik-public-certificates:
[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.web.http]
    [entryPoints.web.http.redirections]
      [entryPoints.web.http.redirections.entryPoint]
        to = "websecure"
        scheme = "https"

  [entryPoints.websecure]
    address = ":443"

[accessLog]

[api]
dashboard = true

[providers]
  [providers.docker]
    exposedByDefault = false

[certificatesResolvers.letsencrypt.acme]
  email = "email@example.app"
  storage = "/certificates/acme.json"
  [certificatesResolvers.letsencrypt.acme.httpChallenge]
    entryPoint = "web"

When using Docker Swarm, the labels need to go into the deploy section (doc).

For simplicity place all TLS globally on entrypoint. Check simple Traefik Swarm example.

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