# Traefik does not route correctly to apps

**URL:** <https://community.traefik.io/t/traefik-does-not-route-correctly-to-apps/14218>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [April 21, 2022, 11:00am UTC](https://community.traefik.io/t/traefik-does-not-route-correctly-to-apps/14218 "2022-04-21T11:00:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sincorchetes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sincorchetes/32/2904_2.png) [@sincorchetes](https://community.traefik.io/u/sincorchetes)\
**Post date:** [April 21, 2022, 11:00am UTC](https://community.traefik.io/t/traefik-does-not-route-correctly-to-apps/14218/1 "2022-04-21T11:00:12Z")

</div>

Good morning,

I have a Traefik deployed over Docker from docker-compose file.

Traefik docker-compose.yml

```auto
version: '3'

services:
  reverse-proxy:
    image: traefik:v2.6
    command:
      - --api.dashboard=true
      - --log.level=INFO
      - --providers.docker
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.web.http.redirections.entryPoint.scheme=https
      - --certificatesresolvers.letsencrypt.acme.email=xxx@xxx
      - --certificatesresolvers.letsencrypt.acme.storage=acme.json
      - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json

    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - le_certs:/letsencrypt
    labels:
      - traefik.enable=true
      - traefik.http.routers.api.entrypoints=websecure
      - traefik.http.routers.api.rule=Host(`xxx.xxx.xxx`)
      - traefik.http.routers.api.tls=true
      - traefik.http.routers.api.tls.certresolver=letsencrypt
      - traefik.http.routers.api.service=api@internal
      - traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.http-catchall.entrypoints=web
      - traefik.http.routers.http-catchall.middlewares=redirect-to-https
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https

    restart: always
volumes:
  le_certs:

```

Web app docker-compose:

```auto
services:
  nodejs:
    image: nodejs
    labels:
      - traefi.enable=true
      - traefik.http.routers.fap.rule=Host(`xxx.xxx.xxx`)
      - traefik.http.routers.fap.entrypoints=websecure
      - traefik.http.routers.fap.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.fap.tls=true
      - traefik.http.routers.fap.tls.certresolver=letsencrypt

```

I cannot access the web app. If I joiin into the Trafik dashboard, I got the Route, Services set up without any error, but you cannot join into the website because you get "Gateway timeout".

However, if you declare in Traefik docker-compose.yml:

```auto
version: '3'
networks:
  default:
    external:
      name: external

services:
  reverse-proxy:
    image: traefik:v2.6
    command:
      - --api.dashboard=true
      - --log.level=INFO
      - --providers.docker
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.web.http.redirections.entryPoint.scheme=https
      - --certificatesresolvers.letsencrypt.acme.email=xxx@xxx
      - --certificatesresolvers.letsencrypt.acme.storage=acme.json
      - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json

    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - le_certs:/letsencrypt
    labels:
      - traefik.enable=true
      - traefik.http.routers.api.entrypoints=websecure
      - traefik.http.routers.api.rule=Host(`xxx.xxx.xxx`)
      - traefik.http.routers.api.tls=true
      - traefik.http.routers.api.tls.certresolver=letsencrypt
      - traefik.http.routers.api.service=api@internal
      - traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.http-catchall.entrypoints=web
      - traefik.http.routers.http-catchall.middlewares=redirect-to-https
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https

    restart: always
volumes:
  le_certs:

```

Web app docker-compose.yml

```auto
version: "3.9" # optional since v1.27.0
networks:
  default:
    external:
      name: external
services:
  nodejs:
    image: nodejs
    labels:
      - traefi.enable=true
      - traefik.http.routers.catalogo_pedrosa.rule=Host(`xxx.xxx.xx`)
      - traefik.http.routers.catalogo_pedrosa.entrypoints=websecure
      - traefik.http.routers.catalogo_pedrosa.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.catalogo_pedrosa.tls=true
      - traefik.http.routers.catalogo_pedrosa.tls.certresolver=letsencrypt

```

That works. What I am wrong?
