# "404 backend not found" error when trying to access domain on Docker Swarm

**URL:** <https://community.traefik.io/t/404-backend-not-found-error-when-trying-to-access-domain-on-docker-swarm/7200>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [August 6, 2020, 1:09pm UTC](https://community.traefik.io/t/404-backend-not-found-error-when-trying-to-access-domain-on-docker-swarm/7200 "2020-08-06T13:09:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhilipsiva](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/dhilipsiva/32/2414_2.png) [@dhilipsiva](https://community.traefik.io/u/dhilipsiva)\
**Post date:** [August 6, 2020, 1:09pm UTC](https://community.traefik.io/t/404-backend-not-found-error-when-trying-to-access-domain-on-docker-swarm/7200/1 "2020-08-06T13:09:43Z")

</div>

I am struggling with this for a week now, and I am not sure what I am doing wrong ☹

I can confirm that all services are up and running on the Swarm cluster.

Here is my docker-compose file:

```auto
version: '3'

volumes:
  traefik_acme:
    driver: local

services:

  worker: &worker
    env_file: .env
    restart: always
    build: ../edvay
    image: ${DOCKER_REGISTRY}/${SETUP_ENV}_worker:1
    command: celery -A tasks.celery worker --loglevel=info

  backend:
    <<: *worker
    command: gunicorn autoapp:app -b :${BACKEND_PORT}
    deploy:
      labels:
        - "traefik.backend.domain=${BACKEND_DOMAIN}"
        - "traefik.docker.lbswarm=true"
        - "traefik.enable=true"
        - "traefik.frontend.rule=Host:${BACKEND_DOMAIN}"
        - "traefik.http.routers.backend.rule=Host(`${BACKEND_DOMAIN}`)"
        - "traefik.http.routers.backend.service=backend"
        - "traefik.http.routers.backend.tls.domains[0].main=${BACKEND_DOMAIN}"
        - "traefik.http.services.backend.loadbalancer.server.port=${$BACKEND_PORT}"

  traefik:
    env_file: .env
    build: traefik
    image: ${DOCKER_REGISTRY}/${SETUP_ENV}_traefik:2
    depends_on:
      - backend
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefik_acme:/etc/traefik/acme/ # Defined in traefik/traefik.toml
    ports:
      - 0.0.0.0:80:80
      - 0.0.0.0:443:443
    deploy:
      placement:
        constraints:
          - node.role == manager

```

Here is `traefik.toml`

```auto
logLevel = "INFO"
defaultEntryPoints = ["https", "http"]

[retry]

# [docker]
# exposedByDefault = false

[Global]
debug = true

[log]
level = "DEBUG"

[accessLog]
# format = "json"

[api]
entryPoint = "traefik"
dashboard = true

[ping]

[providers.docker]
  swarmMode = true
  # endpoint = "unix:///var/run/docker.sock"
  exposedByDefault = false

# Entrypoints, http and https
[entryPoints]
  # http should be redirected to https
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  # https is the default
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

[acme]
email = "dhilipsiva@pm.me"
storage = "/etc/traefik/acme/acme.json"
entryPoint = "https"
acmeLogging = true
onHostRule = true
# caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
# Default: "https://acme-v02.api.letsencrypt.org/directory"

  [acme.dnsChallenge]
  provider = "route53"

```

I tried all possible combinations of labels and nothing seemed to work.  
I build images and push it to AWS ECR. I deploy with `docker deploy -c docker-compose.yml`  
Can someone please point out what I am dong wrong?  
When I try accessing with $BACKEND\_DOMAIN, it only throws a `404 backend not found`

---

<div class="post-metadata">

**Author:** ![ChillarAnand](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/chillaranand/32/2417_2.png) [@ChillarAnand](https://community.traefik.io/u/ChillarAnand)\
**Post date:** [August 6, 2020, 2:58pm UTC](https://community.traefik.io/t/404-backend-not-found-error-when-trying-to-access-domain-on-docker-swarm/7200/2 "2020-08-06T14:58:52Z")

</div>

Did you create a separate router for Traefik? [HTTPS returns `404 page not found`](https://community.containo.us/t/https-returns-404-page-not-found/2629/2)

---

<div class="post-metadata">

**Author:** ![dhilipsiva](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/dhilipsiva/32/2414_2.png) [@dhilipsiva](https://community.traefik.io/u/dhilipsiva)\
**Post date:** [August 6, 2020, 3:15pm UTC](https://community.traefik.io/t/404-backend-not-found-error-when-trying-to-access-domain-on-docker-swarm/7200/3 "2020-08-06T15:15:30Z")

</div>

Oh wow, today must be my lucky day. I got hold of the elusive @ChillarAnand .

I put these labels

```auto
        - "traefik.http.routers.backend.rule=Host(`${BACKEND_DOMAIN}`)"
        - "traefik.http.routers.backend.service=backend"
        - "traefik.http.routers.backend.tls.domains[0].main=${BACKEND_DOMAIN}"

```

Entry points are defined in `traefik.toml` I will also try putting entrypoint labels in the moring and see if it solves anything.

Thanks for the link buddy.
